[quote=369173:@]It seems that some of the code was 32bit only, mainly pointers that will change when moving to 64bit, here’s what you will need to replace. Ideally those memory blocks should be changed to structures but I’m not about to start rewriting the WFS library
See here if you want more information on windows declares: https://blog./2017/01/22/windows-to-xojo-data-type-conversion/
[code]Public Sub LaunchAndWait(extends f as FolderItem, params as String = “”, deskName as String = “”)
// We want to launch the application and wait for
// it to finish executing before we return.
#if TargetWindows
Soft Declare Function CreateProcessW Lib "Kernel32" ( appName as WString, params as WString, _
procAttribs as Integer, threadAttribs as Integer, inheritHandles as Boolean, flags as UInt32, _
env as Integer, curDir as Integer, startupInfo as Ptr, procInfo as Ptr ) as Boolean
Soft Declare Function CreateProcessA Lib "Kernel32" ( appName as CString, params as CString, _
procAttribs as Integer, threadAttribs as Integer, inheritHandles as Boolean, flags as UInt32, _
env as Integer, curDir as Integer, startupInfo as Ptr, procInfo as Ptr ) as Boolean
dim startupInfo, procInfo as MemoryBlock
#If Target64Bit
Const sizeOfPtr = 8
#Else
Const sizeOfPtr = 4
#EndIf
#If Target64Bit
startupInfo = New MemoryBlock( 104 )
#Else
startupInfo = New MemoryBlock( 68 )
#EndIf
procInfo = new MemoryBlock( (2 * sizeOfPtr) + 4 + 4 )
dim unicodeSavvy as Boolean = System.IsFunctionAvailable( "CreateProcessW", "Kernel32" )
startupInfo.Long( 0 ) = startupInfo.Size
dim deskStr, deskPtr as MemoryBlock
if deskName <> "" then
if unicodeSavvy then
deskStr = ConvertEncoding( deskName + Chr( 0 ), Encodings.UTF16 )
else
deskStr = deskName + Chr( 0 )
end if
startupInfo.Ptr( (2 * sizeOfPtr) ) = deskStr
end if
dim ret as Boolean
if unicodeSavvy then
ret = CreateProcessW( f.AbsolutePath, params, 0, 0, false, 0, 0, 0, startupInfo, procInfo )
else
ret = CreateProcessA( f.AbsolutePath, params, 0, 0, false, 0, 0, 0, startupInfo, procInfo )
end if
if not ret then return
Declare Function WaitForSingleObject Lib "Kernel32" ( handle as Integer, howLong as Integer ) as Integer
Const INFINITE = -1
Const WAIT_TIMEOUT = &h00000102
Const WAIT_OBJECT_0 = &h0
// We want to loop here so that we can yield time back
// to other threads. This means threaded applications
// will "just work", but non-threaded ones will still appear hung.
while WaitForSingleObject( procInfo.Long( 0 ), 1 ) = WAIT_TIMEOUT
App.SleepCurrentThread( 10 )
wend
Declare Sub CloseHandle Lib "Kernel32" ( handle as Integer )
CloseHandle( procInfo.Long( 0 ) )
CloseHandle( procInfo.Long( 1 * sizeOfPtr ) )
#else
#pragma unused f
#pragma unused params
#pragma unused deskName
#endif
End Sub
[/code][/quote]
This did indeed fix the issue Julian!!!
I’ve worked with a lot of declares in the past but it would have honestly taken me a lot longer to find this issue and resolve it!
This should be added to the WFS github!
Thanks again!!!