1. Yuri Denshchik
  2. PowerBuilder
  3. Monday, 3 July 2017 19:28 PM UTC

I experienced a problem when calling CreateProcess from 64-bit compiled PB2017 app. On 32-bit it works just fine.

External function defined as:

function boolean CreateProcess(ulong applicationname, string commandline, ulong processattributes, ulong threadattributes, boolean inherithandles, ulong creationflags, ulong environment, string currentdirectory, ref os_startupinfo startupinf, ref os_process_information processinformation) library "kernel32.dll" alias for "CreateProcessA;ansi"

 

os_startupinfo structure defined as:
unsignedlong, string, string, string, unsignedlong, unsignedlong, unsignedlong, unsignedlong, unsignedlong, unsignedlong, unsignedlong, unsignedlong,unsignedinteger, unsignedinteger , long, unsignedlong, unsignedlong

os_process_information structure defined as:

unsignedlong, unsignedlong, unsignedlong, unsignedlong

 

Please advise, 

Thank you,

Yuri

Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Monday, 3 July 2017 21:19 PM UTC
  2. PowerBuilder
  3. # 1

A 64-bit app needs to reference 64-bit DLLs.  From what I can tell you are referencing a 32-bit DLL.

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 4 July 2017 03:18 AM UTC
  2. PowerBuilder
  3. # 2

Hi Yuri;

  Please use the Unicode CreateProcessW API call instead of the old ANSI CreateProcessA. Even in PB 12.6.

Here is the version I use ....

FUNCTION Boolean         CreateProcess (String lpApplicationName, String lpCommandLine, long lpProcessAttributes, long lpThreadAttributes, Boolean bInheritHandles, long dwCreationFlags, long lpEnvironment, String lpCurrentDirectory, STARTUPINFO lpStartupInfo, Ref PROCESS_INFORMATION lpProcessInformation ) Library "KERNEL32.dll" Alias For "CreateProcessW"

HTH

Regards ... Chris

Comment
  1. Yuri Denshchik
  2. Wednesday, 5 July 2017 16:01 PM UTC
Thank you Chris for reply,

Your solution is not working in 64-bit. I end up with defining two external functions, for 32 and 64-bit:



FUNCTION Boolean CreateProcess32 (String lpApplicationName, String lpCommandLine, ulong lpProcessAttributes, ulong lpThreadAttributes, Boolean bInheritHandles, ulong dwCreationFlags, ulong lpEnvironment, String lpCurrentDirectory, ref os_startupinfo lpStartupInfo, ref os_process_information lpProcessInformation ) Library "KERNEL32.dll" Alias For "CreateProcessW"



FUNCTION Boolean CreateProcess64 (String lpApplicationName, String lpCommandLine, longlong lpProcessAttributes, longlong lpThreadAttributes, Boolean bInheritHandles, longlong dwCreationFlags, longlong lpEnvironment, String lpCurrentDirectory, ref os_startupinfo lpStartupInfo, ref os_process_information lpProcessInformation ) Library "KERNEL32.dll" Alias For "CreateProcessW"

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.