Weird System.dll problem...
If I call an API by itself it works, but if I call the same API followed by a second API the first API fails. :weird:
What's even stranger is if I call the first API and then DetailPrint a random variable the first API fails. :weird:
------------------------------------------------
Ex. 1: Uncomment Second API to make fail.
------------------------------------------------
!define APPNAME "Detect New Devices"
!define APPNAMEANDVERSION "Detect New Devices 1.0"
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Detect New Devices"
OutFile "DetectNewDevices.exe"
!include "MUI.nsh"
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_LANGDLL
Section "Detect New Devices" Section1
SetOverwrite on
SetOutPath $INSTDIR
Call GetDevNode
SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} ""
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Function GetDevNode
SetPluginUnload alwaysoff
StrCpy $1 ""
System::Call 'setupapi::CM_Locate_DevNodeA(*i .r0, *t r1r1, i r2r2) i .r3'
;System::Call 'setupapi::CM_Reenumerate_DevNode(*i r0r0, i r4r4) i .r5'
DetailPrint "Var0: $0"
DetailPrint "Var1: $1"
DetailPrint "Var2: $2"
DetailPrint "Ret Val: $3"
SetPluginUnload manual
System::Free 0
FunctionEnd
------------------------------------------------
Ex. 2: Uncomment DetailPrint "Weird: $5" to make fail
------------------------------------------------
!define APPNAME "Detect New Devices"
!define APPNAMEANDVERSION "Detect New Devices 1.0"
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Detect New Devices"
OutFile "DetectNewDevices.exe"
!include "MUI.nsh"
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_LANGDLL
Section "Detect New Devices" Section1
SetOverwrite on
SetOutPath $INSTDIR
Call GetDevNode
SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} ""
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Function GetDevNode
SetPluginUnload alwaysoff
StrCpy $1 ""
System::Call 'setupapi::CM_Locate_DevNodeA(*i .r0, *t r1r1, i r2r2) i .r3'
DetailPrint "Var0: $0"
DetailPrint "Var1: $1"
DetailPrint "Var2: $2"
DetailPrint "Ret Val: $3"
;DetailPrint "Weird: $5"
SetPluginUnload manual
System::Free 0
FunctionEnd
------------------------------------------------
An help on this would be greatly appreciated.
Thanks.
jc3