Re: CreateProcessWithLogonW

new topic     » goto parent     » topic index » view thread      » older message » newer message

-- Marcus:

-- I have added the CreateProcessWithLogonW and constants to the
-- w32engin.ew version 6.40 which can be downloaded here:
    http://www.rapideuphoria.com/w32engin.zip
-- I'am using Win98 and advapi32.DLL does not export the
-- CreateProcessWithLogonW function so I can't test the following code.
-- If you are running windows 2000 or XP. 
-- Maybe the DLL on a 2000 or XP system does export this function.
-- If the function is not exported from your DLL then it maybe that
-- this function can only be used by static linking and you would
-- have to use the "C" translator to link with the advapi32.lib
--
-- Below is all you need to use my win32 engine to test your code to
-- see if you can use the DLL, because I added the function to the 
-- win32 engine.
--
-- Bernie
--
---- begin code ----
include w32engin.ew
----------------------------------------------------------------------------
---
function Logon(sequence Username, sequence Domain,
	 sequence Password, sequence ApplicationName)
--
atom lpUsername,lpDomain,lpPassword,dwLogonFlags,
  lpApplicationName,lpCommandLine,dwCreationFlags,lpEnvironment,
  lpCurrentDirectory,lpStartupInfo,lpProcessInformation, r
--
  lpUsername = szW(Username) -- szW creates a Unicode temporary string
  lpDomain   = szW(Domain)
  lpPassword = szW(Password)
  dwLogonFlags = LOGON_WITH_PROFILE
  lpApplicationName = szW(ApplicationName)
  lpCommandLine = szW("")
  dwCreationFlags = CREATE_NEW_PROCESS_GROUP
  lpEnvironment = NULL
  lpCurrentDirectory = szW("")
  lpStartupInfo = struc("STARTUPINFO")
  lpProcessInformation = struc("PROCESS_INFORMATION")
  -- call create process
  r = CreateProcessWithLogonW({lpUsername,lpDomain,lpPassword,
	dwLogonFlags,lpApplicationName,lpCommandLine,
	dwCreationFlags,lpEnvironment,lpCurrentDirectory,
	lpStartupInfo,lpProcessInformation})
  -- free the resources
  szfree() -- frees the unicode strings
  free_mem({lpStartupInfo,lpProcessInformation}) -- frees the structures
  return r
end function
--
? Logon("admin",".","admin123","C:\\WINNT\\NOTEPAD.EXE")
? GetLastError()
---- end code ----

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu