|
|||
|
Quote:
...please write here sample... :-[ |
|
|||
|
Code:
struct {
unsigned long cb;
char* lpReserved;
char* lpDesktop;
char* lpTitle;
unsigned long dwX;
unsigned long dwY;
unsigned long dwXSize;
unsigned long dwYSize;
unsigned long dwXCountChars;
unsigned long dwYCountChars;
unsigned long dwFillAttribute;
unsigned long dwFlags;
unsigned short wShowWindow;
unsigned short cbReserved2;
pointer lpReserved2;
pointer hStdInput;
pointer hStdOutput;
pointer hStdError;
} STARTUPINFOA;
struct {
pointer hProcess;
pointer hThread;
unsigned long dwProcessId;
unsigned long dwThreadId;
} PROCESS_INFORMATION;
dllimport "kernel32.dll" stdcall Boolean CloseHandle(pointer);
dllimport "kernel32.dll" stdcall Boolean CreateProcessA(
String lpApplicationName,// name of executable module
String lpCommandLine,// command line string
pointer lpProcessAttributes,// SD
pointer lpThreadAttributes,// SD
Boolean bInheritHandles,// handle inheritance option
unsigned int dwCreationFlags,// creation flags
pointer lpEnvironment,// new environment block
String lpCurrentDirectory,// current directory name
STARTUPINFOA* lpStartupInfo,// startup information
PROCESS_INFORMATION* lpProcessInformation// process information
);
var NORMAL_PRIORITY_CLASS = 0x00000020;
var IDLE_PRIORITY_CLASS = 0x00000040;
var HIGH_PRIORITY_CLASS = 0x00000080;
var REALTIME_PRIORITY_CLASS = 0x00000100;
var BELOW_NORMAL_PRIORITY_CLASS = 0x00004000;
var ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000;
function runAppWithPriority(command, priority) {
var pi = new Object;
pi.value = new Struct(PROCESS_INFORMATION);
var si = new Struct(STARTUPINFOA);
si.cb = si.structSize;
var result = CreateProcessA(null, command, null, null, false,
priority, null, null, si, pi);
if (!result) return false;
CloseHandle(pi.value.hThread);
CloseHandle(pi.value.hProcess);
return true;
}
runAppWithPriority("notepad.exe", IDLE_PRIORITY_CLASS);
|
|
|||
|
Code:
struct {
unsigned long cb;
char* lpReserved;
char* lpDesktop;
char* lpTitle;
unsigned long dwX;
unsigned long dwY;
unsigned long dwXSize;
unsigned long dwYSize;
unsigned long dwXCountChars;
unsigned long dwYCountChars;
unsigned long dwFillAttribute;
unsigned long dwFlags;
unsigned short wShowWindow;
unsigned short cbReserved2;
pointer lpReserved2;
pointer hStdInput;
pointer hStdOutput;
pointer hStdError;
} STARTUPINFOA;
struct {
pointer hProcess;
pointer hThread;
unsigned long dwProcessId;
unsigned long dwThreadId;
} PROCESS_INFORMATION;
dllimport "kernel32.dll" stdcall Boolean CloseHandle(pointer);
dllimport "Advapi32.dll" stdcall Boolean CreateProcessWithLogonW(
short* username,
short* domain,
short* password,
unsigned int dwLogonFlags,
short* lpApplicationName, // name of executable module
short* lpCommandLine, // command line string
unsigned int dwCreationFlags, // creation flags
pointer lpEnvironment, // new environment block
String lpCurrentDirectory, // current directory name
STARTUPINFOA* lpStartupInfo, // startup information
PROCESS_INFORMATION* lpProcessInformation // process information
);
var NORMAL_PRIORITY_CLASS = 0x00000020;
var IDLE_PRIORITY_CLASS = 0x00000040;
var HIGH_PRIORITY_CLASS = 0x00000080;
var REALTIME_PRIORITY_CLASS = 0x00000100;
var BELOW_NORMAL_PRIORITY_CLASS = 0x00004000;
var ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000;
function runAppWithPriority(username, password, command, priority) {
var pi = new Object;
pi.value = new Struct(PROCESS_INFORMATION);
var si = new Struct(STARTUPINFOA);
si.cb = si.structSize;
var result = CreateProcessWithLogonW(username, ".", password,
/*LOGON_WITH_PROFILE*/0x000001, null, command,
priority, null, null, si, pi);
if (!result) return false;
CloseHandle(pi.value.hThread);
CloseHandle(pi.value.hProcess);
return true;
}
runAppWithPriority("Administrator", "*********", "notepad.exe", IDLE_PRIORITY_CLASS);
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|