Finderx Preview

Originally posted by Daxziz@Mar 28 2004, 10:47 PM

I promise you that it can't harm your system, so can someone please tell me whatever the Reboot and Shut Down menuitems are working.

I've downloaded the file from the last link, the file is named FinderXc.exe. Is that the right version? When i click on reboot or shut down nothing happens.

#136432

Ok - that's odd. It should work. Yes, and it's the right version. I'll look at it - still wiping though.

*mumbles*

-Daxziz

#136444

Well - I've tested this on 2K now and that works fine, both the shutdown and reboot part.

Are you using 9x ? I didn't think ppl did that anymore <_<

-Daxziz

#136452

Yet a version up. Now with Hibernate ( Sleep ) function.

I need reports for which systems this works for. I've tested at 2K myself, will do on XP too, but that should work too. I need to hear reports from ALL systems though. Remember to tell what Win version you're using.

The url is still: http://129.142.201.212/FinderX-Preview.zip

-Daxziz

#136468

Originally posted by Daxziz@Mar 28 2004, 11:52 PM

Are you using 9x ? I didn't think ppl did that anymore  <_<

9x? It's a while back since i used that, atm i'm using xp.

I'm going to test the new version. ;)

#136473

Sleep Mode works fine, reboot and shutdown still don't work for me. As said i'm running a (german) windows xp with sp1.

when i click on reboot or shutdown nothing happens.

#136477

Do you have advapi32.dll ?

-Daxziz

#136478

Originally posted by Daxziz@Mar 29 2004, 12:43 AM

Do you have advapi32.dll ?

-Daxziz

Yes it's located in windows\system32 folder, the dll says version 5.1.2600.1106

#136482

Hmm the version should be ok - indeed since this is working on Windows 2K as well.

I'm however not using the shutdown.exe to intercept my commands, but what happens if tou type this "shutdown -s -t 240" in either "Run" or a CMD shell ?

You can always stop with "shutdown -a" if it does work.

My guess is however that shutdown.exe calls this dll anyway.

Also try search google for the dll and replace your own with that - it *might* be damaged.

-Daxziz

#136485

Hey guys -

Here's the Apple.com clone for FinderX, currently very much empty:

http://iindigo3d.2w.ca/finderx/

What do you guys (mainly Daxziz) think? :rock: :rock:

#136514

i dont get it

#136531

@carbonfiber: You must have missed Daxziz's earlier post asking for an Apple.com clone for the FinderX site... Well this is my answer

#136553

I like it :)

I hope you're ready to bring more content to it soon

Especially making a Screenshot and a Download tab, and of course news at the front page. ;)

-Daxziz

#136622

Reworking the windows - I need some perfect "unbroken" real 1:1 sized brushed metal. If anyone has such please post here.

EDIT: To those who didn't get it, after reading the stuff between the linies above: YES - I'm working on the Panther windows.

-Daxziz

#136673

Originally posted by Daxziz@Mar 29 2004, 01:01 AM

but what happens if tou type this "shutdown -s -t 240" in either "Run" or a CMD shell ?

You can always stop with "shutdown -a" if it does work.

I get a new window with a shutdown countdown with the shutdown -a command the dialog goes away so i guess it's working.

#136681

HMMM I'll have to go deeper into this. Can't give an answer now - sorry.

-Daxziz

#136682

I think your application doesn't have the right priviliges to shutdown/reboot the computer.

BOOL SetPrivilege(
   HANDLE hToken,          // access token handle
   LPCTSTR lpszPrivilege,  // name of privilege to enable/disable
   BOOL bEnablePrivilege   // to enable or disable privilege
   )
{
TOKEN_PRIVILEGES tp;
LUID luid;

if ( !LookupPrivilegeValue(
       NULL,            // lookup privilege on local system
       lpszPrivilege,   // privilege to lookup
       &luid ) )        // receives LUID of privilege
{
   return FALSE;
}

tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
if (bEnablePrivilege)
   tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
else
   tp.Privileges[0].Attributes = 0;

// Enable the privilege or disable all privileges.

if ( !AdjustTokenPrivileges(
      hToken,
      FALSE,
      &tp,
      sizeof(TOKEN_PRIVILEGES),
      (PTOKEN_PRIVILEGES) NULL,
      (PDWORD) NULL) )
{
     return FALSE;
}

return TRUE;
}

Call it like

	HANDLE hToken;
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken);
SetPrivilege(hToken,SE_SHUTDOWN_NAME,TRUE);
CloseHandle(hToken);

to shutdown/reboot:

  BOOL bDidStartShutDown = ExitWindowsEx(EWX_POWEROFF,0);

#136684

Right. But I was trying to find a way to avoid that code ;)

It might end with using that though.

-Daxziz

#136685

Why avoid it? It isn't a lot of code and it's kinda trivial ( I believe this snippet can be found on MSDN) :blink::blink:

Edit: Sorry, forgat that you are using a BASIC dialect, don't know if you have the possibility to use WINAPIs.

Windows NT: To shut down or restart the system, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege. For more information about security privileges, see Privileges.

No other way on NT/2000/XP, so it looks like you end using it.

#136689

Oh I can use WINAPI alright, and dll calls too. ;)

RapidQ is very powerful - it's a clone of Delphi, C++ and a little VB ( very little - thank god )

-Daxziz

#136691

Well AndreasV - if I could have used this:

DECLARE FUNCTION InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage As String, ByVal dwTimeout As Long, ByVal bForceAppsClosed As Long, ByVal bRebootAfterShutdown As Long) As Long

and just call this in a sub:

InitiateSystemShutdown "", "", 0, True, False

Then it would be quite fast to do so ;)

Agreed - also a little lazy, but sometimes I don't feel like inventing something new again. Not that I would be doing it from scratch, but since this dll should already handle it quite fast, then that was my first attempt to try this.

But in the long run, the code sample you provided might be the only real solution. We'll see.

-Daxziz

#136692

You would still get the same problem:

The InitiateSystemShutdown function initiates a shutdown and optional restart of the specified computer.

BOOL InitiateSystemShutdown(

    LPTSTR lpMachineName, // address of name of computer to shut down 

    LPTSTR lpMessage, // address of message to display in dialog box

    DWORD dwTimeout, // time to display dialog box

    BOOL bForceAppsClosed, // force applications with unsaved changes flag

    BOOL bRebootAfterShutdown  // reboot flag

   );

Parameters

lpMachineName

Points to the null-terminated string that specifies the network name of the computer to shut down. If lpMachineName is NULL or points to an empty string, the function shuts down the local computer.

lpMessage

Points to a null-terminated string that specifies a message to display in the shutdown dialog box. This parameter can be NULL if no message is required.

dwTimeout

Specifies the time (in seconds) that the dialog box should be displayed. While this dialog box is displayed, the shutdown can be stopped by the AbortSystemShutdown function.

If dwTimeout is not zero, InitiateSystemShutdown displays a dialog box on the specified computer. The dialog box displays the name of the user who called the function, displays the message specified by the lpMessage parameter, and prompts the user to log off. The dialog box beeps when it is created and remains on top of other windows in the system. The dialog box can be moved but not closed. A timer counts down the remaining time before a forced shutdown. If the user logs off, the system shuts down immediately. Otherwise, the computer is shut down when the timer expires.

If dwTimeout is zero, the computer shuts down without displaying the dialog box, and the shutdown cannot be stopped by AbortSystemShutdown.

bForceAppsClosed

Specifies whether applications with unsaved changes are to be forcibly closed. If this parameter is TRUE, such applications are closed. If this parameter is FALSE, a dialog box is displayed prompting the user to close the applications.

bRebootAfterShutdown

Specifies whether the computer is to restart immediately after shutting down. If this parameter is TRUE, the computer is to restart. If this parameter is FALSE, the system flushes all caches to disk, clears the screen, and displays a message indicating that it is safe to power down.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

To shut down the local computer, the calling process must have the SE_SHUTDOWN_NAME privilege. To shut down a remote computer, the calling process must have the SE_REMOTE_SHUTDOWN_NAME privilege on the remote computer. By default, users can enable the SE_SHUTDOWN_NAME privilege on the computer they are logged onto, and administrators can enable the SE_REMOTE_SHUTDOWN_NAME privilege on remote computers.

Common failures include an invalid or inaccessible computer name or insufficient privilege.

See Also

AbortSystemShutdown

Source: Win32 SDK.

ExitWindows()/ExitWindowsEx() are inside the same DLL btw.

#136693

The call I wrote above is the one I currently are using, and it does work on Win 2K - there must be a reason why it doesn't work other places.

But I thank you for bringing the codes to my attention, AndreasV. They might easily be needed ;)

-Daxziz

#136701

Small update. Still working at the Panther window - I'm trying to make it as best as possible, and of course "share" resources with the Desktop Icons.

So far it has the design, and can list the drives in the computer ( just like the desktop ) but it still lack a lot.

-Daxziz

#137542

Now it finally lists the icons in the box - next step will be to list the actual content of the drive :)

....This is taking some time *lol*....

-Daxziz

#137938