>> Clear DLLs >> >>* Logon Flags >> >> #Define LOGON_WITH_PROFILE 0x00000001 >> #Define LOGON_NETCREDENTIALS_ONLY 0x00000002 >> >>* Creation Flags >> >> #Define CREATE_SUSPENDED 0x00000004 >> #Define CREATE_NEW_CONSOLE 0x00000010 >> #Define CREATE_NEW_PROCESS_GROUP 0x00000200 >> #Define CREATE_UNICODE_ENVIRONMENT 0x00000400 >> #Define CREATE_SEPARATE_WOW_VDM 0x00000800 >> #Define CREATE_DEFAULT_ERROR_MODE 0x04000000 >> >>* Priority Flags >> >> #Define NORMAL_PRIORITY_CLASS 32 >> #Define IDLE_PRIORITY_CLASS 64 >> #Define HIGH_PRIORITY_CLASS 128 >> #Define REALTIME_PRIORITY_CLASS 1600 >> >> #Define STARTF_USESHOWWINDOW 1 >> #Define SW_SHOWNORMAL 1 >> >> Declare Integer CreateProcessWithLogonW In advapi32 String lpUsername , ; >> String lpDomain , ; >> String lpPassword , ; >> Integer dwLogonFlags , ; >> String lpApplicationName , ; >> String lpCommandLine , ; >> Integer dwCreationFlags , ; >> Integer lpEnvironment , ; >> String lpCurrentDirectory , ; >> String @lpStartupInfo , ; >> String @lpProcessInformation >> >> >> cUsername = "MyUsername" >> cPassword = "MyPassword" >> cDomain = "MyDomain" >> nLogonFlags = LOGON_NETCREDENTIALS_ONLY >> cApplicationName = "c:\windows\notepad.exe" + chr (0) >> cCommandLine = chr (0) >> >> nCreationFlags = NORMAL_PRIORITY_CLASS + ; >> CREATE_DEFAULT_ERROR_MODE + ; >> CREATE_NEW_CONSOLE + ; >> CREATE_NEW_PROCESS_GROUP >> >> nEnvironment = 0 >> cCurrentDirectory = chr (0) >> >> cStartupInfo = num2dword (68) + ; >> num2dword (0) + ; >> num2dword (0) + ; >> num2dword (0) + ; >> num2dword (0) + ; >> num2dword (0) + ; >> num2dword (0) + ; >> num2dword (0) + ; >> num2dword (0) + ; >> num2dword (0) + ; >> num2dword (0) + ; >> num2dword (STARTF_USESHOWWINDOW) + ; >> num2dword (SW_SHOWNORMAL ) + ; >> num2dword (0) + ; >> num2dword (0) + ; >> num2dword (0) + ; >> num2dword (0) >> >> cProcessInformation = Replicate (Chr (0), 16) >> >> If CreateProcessWithLogonW ( cUsername , ; >> cDomain , ; >> cPassword , ; >> nLogonFlags , ; >> cApplicationName , ; >> cCommandLine , ; >> nCreationFlags , ; >> nEnvironment , ; >> cCurrentDirectory , ; >> @cStartupInfo , ; >> @cProcessInformation) = 0 >> >> ShowLastError () >> >> Return >> >> EndIf >> >> >>* =========================================================================== >> >> Procedure ShowLastError >>*-------- -------------- >> >> #Define FORMAT_MESSAGE_FROM_SYSTEM 4096 >> >> Declare Integer GetLastError In Kernel32 >> >> Declare Integer FormatMessage In Kernel32 Integer dwFlags , ; >> String lpSource , ; >> Integer dwMessageId , ; >> Integer dwLanguageId , ; >> String @lpBuffer , ; >> Integer nSize , ; >> Integer Arguments >> >> nLastError = GetLastError () >> cMessageText = Space (256) >> nRetCode = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, 0, nLastError, 0, @cMessageText, 256, 0) >> >> Messagebox ("Error #" + lTrim (Str (nLastError)) + ":" + cMessageText) >> >> Return >> >>* =========================================================================== >> >> Function num2dword (lnValue) >>*-------- --------- >> >> #DEFINE m0 0x0000100 >> #DEFINE m1 0x0010000 >> #DEFINE m2 0x1000000 >> >> IF lnValue < 0 >> nValue = 0x100000000 + lnValue >> ENDIF >> >> LOCAL b0, b1, b2, b3 >> >> b3 = Int(lnValue/m2) >> b2 = Int((lnValue - b3*m2)/m1) >> b1 = Int((lnValue - b3*m2 - b2*m1)/m0) >> b0 = Mod(lnValue, m0) >> >> RETURN Chr(b0)+Chr(b1)+Chr(b2)+Chr(b3) >> >> EndFunc >> >>* =========================================================================== >>