Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2006, 10:15 PM
Member
 
Join Date: Jul 2006
Posts: 33
Default Run application priority...

Whether it is possible to start the appendix with a high priority?
Reply With Quote
  #2 (permalink)  
Old 08-15-2006, 02:22 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Run application priority...

To do this, you would have to call windows API directly in swfkit pro 3.
Reply With Quote
  #3 (permalink)  
Old 08-15-2006, 03:19 PM
Member
 
Join Date: Jul 2006
Posts: 33
Default Re:Run application priority...

Quote:
Originally Posted by SWFKIT
To do this, you would have to call windows API directly in swfkit pro 3.
I am sorry... But whether it is impossible to tell about it more in detail? :-\

...please write here sample... :-[
Reply With Quote
  #4 (permalink)  
Old 07-30-2007, 02:39 PM
Member
 
Join Date: Jul 2006
Posts: 33
Default Re:Run application priority...

help :'( :'(
Reply With Quote
  #5 (permalink)  
Old 07-31-2007, 12:03 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Run application priority...

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);
Reply With Quote
  #6 (permalink)  
Old 08-04-2007, 01:50 PM
Member
 
Join Date: Jul 2006
Posts: 33
Default Re:Run application priority...

thanks :-*

Reply With Quote
  #7 (permalink)  
Old 08-06-2007, 07:40 PM
Member
 
Join Date: Jul 2006
Posts: 33
Default Re:Run application priority...

How create process by SYSTEM-user?...or other users and Deny the Kill Process ...please Help me :-[
Reply With Quote
  #8 (permalink)  
Old 08-07-2007, 11:18 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Run application priority...

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);
Reply With Quote
  #9 (permalink)  
Old 08-07-2007, 09:52 PM
Member
 
Join Date: Jul 2006
Posts: 33
Default Re:Run application priority...

sorry, but this not work... :-[ :'(
Reply With Quote
  #10 (permalink)  
Old 08-08-2007, 01:27 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Run application priority...

You must set correct password for "administrator". The code should work well, as it has been tested.
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:49 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.