WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Forum
   Search    Users    Calendar    Board Help  

Pages: (5) [1] 2 3 ... Last »  ( Go to first unread post ) Reply to this topicStart new topicStart Poll

Using the SetSuspendState API (Powrprof.dll), Setting the system to suspended (sleep) or hibernation mode.

Lahar
Posted: Sep 12 2007, 11:32 PM
Quote Post


Active Member
***

Group: Members
Posts: 50
Member No.: 5522
Joined: 18-August 07


Which lib contains the SetSuspendState function. I searched in masm32/include folder and i didn't find anything. So i used this code and it worked. It could have been done easily in single line when invoke is used...
CODE

.DATA

LibName         db   "Powrprof.dll",0
FunctionName    db   "SetSuspendState",0

.CODE
...
...
  invoke LoadLibrary, addr LibName
  mov hModule, eax
  invoke GetProcAddress, hModule, addr FunctionName
  push 1
  push 0
  push 1
  call eax
  invoke FreeLibrary, hModule


Also if u have any src/links for Shutdown, Restart, sleep, please post here

__Lahar__

PMEmail Poster
Top
samael
Posted: Sep 12 2007, 11:57 PM
Quote Post


Typo-lord
******

Group: Admins
Posts: 292
Member No.: 5187
Joined: 10-June 07


Try this lib.
I created it using Vortex's DLL to module definition & include file converter V1.2, although i modified a bit the .def file before i pass it to lib.exe (see also the included .bat file for the appropriate switches).

I haven't defined arguments for the function prototypes though (in Powrprof.inc), you could do it by looking at their definitions in the SDK.

Have a nice day.

Attached File ( Number of downloads: 22 )
Attached File  powrprof.zip
PM
Top
Lahar
Posted: Sep 13 2007, 07:02 AM
Quote Post


Active Member
***

Group: Members
Posts: 50
Member No.: 5522
Joined: 18-August 07


First of all thanks for the reply samael. I have some problems with the custom lib creating with lib.exe. But at the sametime the lib created with polib works without any problem.

__Lahar__
PMEmail Poster
Top
samael
Posted: Sep 13 2007, 09:25 AM
Quote Post


Typo-lord
******

Group: Admins
Posts: 292
Member No.: 5187
Joined: 10-June 07


The .lib is not the problem.
The problem locates in the .INC file.
Replace all "SYSCALL" references in that file with "C" (without quotes).
Also, if you are going to use INVOKE to call a function, you must define the arguments in the prototypes of the functions you are going to use.
Check the attachment for an example.

Attached File ( Number of downloads: 19 )
Attached File  POWRPROF.zip
PM
Top
Lahar
Posted: Sep 13 2007, 10:48 AM
Quote Post


Active Member
***

Group: Members
Posts: 50
Member No.: 5522
Joined: 18-August 07


Actually SYSCALL didn't created me any problems. I can still compile and execute the project without anything changing other than function arguments. I am attaching the files below.
__Lahar__

Attached File ( Number of downloads: 23 )
Attached File  HIBERNATE.zip
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Pages: (5) [1] 2 3 ... Last » Reply to this topicStart new topicStart Poll