shlwapi.def don't work
shlwapi.def don't work
if i use the dll importer with this
SHLWAPI.DLL
ChrCmpIA 2
ChrCmpIW 2
IntlStrEqWorkerA 4
IntlStrEqWorkerW 4
SHStrDupA 2
SHStrDupW 2
StrCatA 2
StrCatW 2
StrCatBuffA 3
StrCatBuffW 3
StrCatChainW 4
;StrChrA 2
;StrChrW 2
;StrChrIA 2
;StrChrIW 2
;StrCmpIW 2
;StrCmpW 2
StrCpyW 2
StrCpyNW 3
;StrCmpNA 3
;StrCmpNW 3
;StrCmpNIA 3
;StrCmpNIW 3
StrCSpnA 2
StrCSpnW 2
StrCSpnIA 2
StrCSpnIW 2
StrDupA 1
StrDupW 1
StrFormatByteSize64A 3
StrFormatByteSizeA 3
StrFormatByteSizeW 3
StrFormatKBSizeA 3
StrFormatKBSizeW 3
StrFromTimeIntervalA 4
StrFromTimeIntervalW 4
StrIsIntlEqualA 4
StrIsIntlEqualW 4
StrNCatA 3
StrNCatW 3
StrPBrkA 2
StrPBrkW 2
;StrRChrA 3
;StrRChrW 3
;StrRChrIA 3
;StrRChrIW 3
StrRetToBufA 4
StrRetToBufW 4
StrRetToStrA 3
StrRetToStrW 3
;StrRStrIA 3
;StrRStrIW 3
StrSpnA 2
StrSpnW 2
;StrStrA 2
;StrStrIA 2
;StrStrIW 2
;StrStrW 2
StrToIntA 1
StrToIntW 1
StrToIntExA 3
StrToIntExW 3
StrTrimA 2
StrTrimW 2
and then i call StrFormatByteSizeA_() , not a function...
StrFormatByteSizeW_() crashes
Procedure.s FormatByteSize(bytes)
OpenLibrary(0, "shlwapi.dll")
ret$ = Space(100)
CallFunction(0, "StrFormatByteSizeA", bytes, @ret$, 100)
CloseLibrary(0)
ProcedureReturn ret$
EndProcedure
works, can someone explain?
SHLWAPI.DLL
ChrCmpIA 2
ChrCmpIW 2
IntlStrEqWorkerA 4
IntlStrEqWorkerW 4
SHStrDupA 2
SHStrDupW 2
StrCatA 2
StrCatW 2
StrCatBuffA 3
StrCatBuffW 3
StrCatChainW 4
;StrChrA 2
;StrChrW 2
;StrChrIA 2
;StrChrIW 2
;StrCmpIW 2
;StrCmpW 2
StrCpyW 2
StrCpyNW 3
;StrCmpNA 3
;StrCmpNW 3
;StrCmpNIA 3
;StrCmpNIW 3
StrCSpnA 2
StrCSpnW 2
StrCSpnIA 2
StrCSpnIW 2
StrDupA 1
StrDupW 1
StrFormatByteSize64A 3
StrFormatByteSizeA 3
StrFormatByteSizeW 3
StrFormatKBSizeA 3
StrFormatKBSizeW 3
StrFromTimeIntervalA 4
StrFromTimeIntervalW 4
StrIsIntlEqualA 4
StrIsIntlEqualW 4
StrNCatA 3
StrNCatW 3
StrPBrkA 2
StrPBrkW 2
;StrRChrA 3
;StrRChrW 3
;StrRChrIA 3
;StrRChrIW 3
StrRetToBufA 4
StrRetToBufW 4
StrRetToStrA 3
StrRetToStrW 3
;StrRStrIA 3
;StrRStrIW 3
StrSpnA 2
StrSpnW 2
;StrStrA 2
;StrStrIA 2
;StrStrIW 2
;StrStrW 2
StrToIntA 1
StrToIntW 1
StrToIntExA 3
StrToIntExW 3
StrTrimA 2
StrTrimW 2
and then i call StrFormatByteSizeA_() , not a function...
StrFormatByteSizeW_() crashes
Procedure.s FormatByteSize(bytes)
OpenLibrary(0, "shlwapi.dll")
ret$ = Space(100)
CallFunction(0, "StrFormatByteSizeA", bytes, @ret$, 100)
CloseLibrary(0)
ProcedureReturn ret$
EndProcedure
works, can someone explain?
-
FloHimself
- Enthusiast

- Posts: 229
- Joined: Wed May 14, 2003 3:38 pm
- Location: Lüneburg - Germany
noticed this behavior before, when working with the lua dll.
if you only use
//EDIT:
its not a bug, its a feature!
"StrFormatByteSizeA" becomes "StrFormatByteSize" (w/o the A)
so call it with:
if you only use
as pbl file, it recognizes the function. maybe a bug in the dll importer?SHLWAPI.DLL
StrFormatByteSizeA 3
//EDIT:
its not a bug, its a feature!
"StrFormatByteSizeA" becomes "StrFormatByteSize" (w/o the A)
so call it with:
Code: Select all
StrFormatByteSize_()-
FloHimself
- Enthusiast

- Posts: 229
- Joined: Wed May 14, 2003 3:38 pm
- Location: Lüneburg - Germany
w00t? this drives me insane! 8O
i just deleted all created import libraries and tried again. it don't work anymore..
don't know what i've done before.. just played with the lib and worked as explained. that is the bad news. the good one is, i can fix your problem, if you create the complete .pbl file for the dll importer! if you don't use unicode (16-bit wide char) strings, ignore the "FunctionNameW"'s!
i just deleted all created import libraries and tried again. it don't work anymore..
-
FloHimself
- Enthusiast

- Posts: 229
- Joined: Wed May 14, 2003 3:38 pm
- Location: Lüneburg - Germany
ok, try this:
1) make a .pbl file. (like always)
2) use the dll importer. (like always)
3) get this tool (ERUPLLDE_Fixer).
4) use it after you used the dll importer.
5) try this
6) give feedback if it works.
1) make a .pbl file. (like always)
2) use the dll importer. (like always)
3) get this tool (ERUPLLDE_Fixer).
4) use it after you used the dll importer.
5) try this
Code: Select all
ret$ = Space(100)
StrFormatByteSizeA_(15, @ret$, 50)
Debug ret$-
FloHimself
- Enthusiast

- Posts: 229
- Joined: Wed May 14, 2003 3:38 pm
- Location: Lüneburg - Germany
-
FloHimself
- Enthusiast

- Posts: 229
- Joined: Wed May 14, 2003 3:38 pm
- Location: Lüneburg - Germany
when you use the dll importer there is created a special lib called SHLWAPI in folder [..]\PureBasic\PureLibraries\Windows\
this tool fixes this library so the purebasic compiler recognizes correct the functions as "StrFormatByteSizeA_()".
if you dont want to use my tool, because you don't want to run unknown exes (i understand why) you can hex-edit the mentioned file.
//EDIT:
btw: you can use the source, of course, and compile it yourself.
ERUPLLDE_Fixer.pb:
Common.pb:
Util.pb:
this tool fixes this library so the purebasic compiler recognizes correct the functions as "StrFormatByteSizeA_()".
if you dont want to use my tool, because you don't want to run unknown exes (i understand why) you can hex-edit the mentioned file.
//EDIT:
btw: you can use the source, of course, and compile it yourself.
ERUPLLDE_Fixer.pb:
Code: Select all
; PureBasic Visual Designer v3.90 build 1360
#VERSION.s = "0.1"
IncludeFile "Common.pb"
IncludeFile "Util.pb"
Global sSourcePath$
Global sDestinationPath$
Open_Window_0()
LoadPrefs()
SetGadgetText(#String_0, sSourcePath$)
SetGadgetText(#String_1, sDestinationPath$)
Repeat
Event = WaitWindowEvent()
If Event = #PB_EventGadget
;Debug "WindowID: " + Str(EventWindowID())
GadgetID = EventGadgetID()
If GadgetID = #String_0
sSourcePath$ = GetGadgetText(#String_0)
ElseIf GadgetID = #String_1
sDestinationPath$ = GetGadgetText(#String_1)
ElseIf GadgetID = #Button_0
Debug "GadgetID: #Button_0"
If ExamineDirectory(#PB_Any, sDestinationPath$ + "PureLibraries\Windows\", "*.")
sPblFileName$ = OpenFileRequester("Please select .pbl File", "", "DLL Definifions (.pbl)|*.pbl", 0)
If sPblFileName$
GenerateERUPLLDE(sPblFileName$, sDestinationPath$ + "PureLibraries\Windows\")
Else
MessageRequester("Error", "Error while trying to fix!", #MB_ICONSTOP | #MB_OK)
EndIf
Else
MessageRequester("Error", "Is this the PureBasic path correct?", #MB_ICONSTOP | #MB_OK)
EndIf
SavePrefs()
ElseIf GadgetID = #Button_1
Debug "GadgetID: #Button_1"
Event = #PB_EventCloseWindow
ElseIf GadgetID = #Button_2
; PATH 1
Debug "GadgetID: #Button_2"
sTempSourcePath$ = PathRequester("Select the source directory", sSourcePath$)
If sTempSourcePath$
sSourcePath$ = sTempSourcePath$
SetGadgetText(#String_0, sSourcePath$)
EndIf
ElseIf GadgetID = #Button_3
Debug "GadgetID: #Button_3"
sTempDestinationPath$ = PathRequester("Select the destination directory", sDestinationPath$)
If sTempDestinationPath$
sDestinationPath$ = sTempDestinationPath$
SetGadgetText(#String_1, sDestinationPath$)
EndIf
EndIf
EndIf
Until Event = #PB_EventCloseWindow
EndCode: Select all
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Text_0
#Text_1
#String_0
#String_1
#Button_0
#Button_1
#Button_2
#Button_3
#CheckBox_0
#Text_2
EndEnumeration
Procedure Open_Window_0()
If OpenWindow(#Window_0, 277, 328, 399, 121, #PB_Window_SystemMenu | #PB_Window_TitleBar , "ERUPLLDE Fixer v"+#VERSION)
If CreateGadgetList(WindowID())
TextGadget(#Text_0, 10, 10, 120, 20, "DLL Definition path :")
TextGadget(#Text_1, 10, 35, 115, 20, "PureBasic path :")
StringGadget(#String_0, 150, 10, 210, 20, "")
StringGadget(#String_1, 150, 35, 210, 20, "")
ButtonGadget(#Button_0, 10, 89, 190, 25, "Start")
ButtonGadget(#Button_1, 210, 89, 180, 25, "Quit")
ButtonGadget(#Button_2, 365, 10, 25, 20, "...")
ButtonGadget(#Button_3, 365, 35, 25, 20, "...")
EndIf
EndIf
EndProcedureCode: Select all
Enumeration
#PBL_File
#ERUPLLDE_File
#PREFS_File
EndEnumeration
Procedure.s ExePath()
ExePath$ = Space(1000)
GetModuleFileName_(0,@ExePath$,1000)
ProcedureReturn GetPathPart(ExePath$)
EndProcedure
Procedure.l GenerateERUPLLDE(sPblFileName$, sDestinationPath$)
Protected sDllName$
Protected sERUPLLDEName$
Protected sDestinationPath$
ReadFile(#PBL_File, sPblFileName$)
sDllName$ = Trim(ReadString())
Debug sDllName$
If UCase(Right(sDllName$, 4)) <> ".DLL"
MessageRequester("Error", "Malformed line. Should be in the form: DllName.DLL", #MB_ICONSTOP | #MB_OK)
ProcedureReturn #False
EndIf
sERUPLLDEName$ = Left(sDllName$, Len(sDllName$)-4)
DeleteFile(sDestinationPath$ + sERUPLLDEName$)
If OpenFile(#ERUPLLDE_File, sDestinationPath$ + sERUPLLDEName$)
WriteString("ERUPLLDE")
WriteByte(1)
WriteString(sERUPLLDEName$)
WriteByte(0)
EndIf
UseFile(#PBL_File)
Repeat
sLine$ = Trim(ReadString())
If CountString(sLine$, " ") = 0
MessageRequester("Error", "Malformed line. Should be in the form: FunctionName NbParameter", #MB_ICONSTOP | #MB_OK)
ProcedureReturn #False
EndIf
sFunctionName$ = Trim(StringField(sLine$, 1, " "))
nFunctionParam.l = Val(Trim(StringField(sLine$, 2, " ")))
If Left(Trim(StringField(sLine$, 1, " ")), 1) <> ";"
UseFile(#ERUPLLDE_File)
Debug sFunctionName$
WriteString(sFunctionName$)
WriteByte(0)
Debug nFunctionParam
WriteByte(nFunctionParam)
WriteByte(0)
EndIf
UseFile(#PBL_File)
Until Eof(#PBL_File)
CloseFile(#PBL_File)
CloseFile(#ERUPLLDE_File)
MessageRequester("Info", "Fixing finished." + Chr(10) + Chr(10) + "Tried To fix the File: " + Chr(10) + Chr(10) + sDestinationPath$ + sERUPLLDEName$, #MB_OK | #MB_ICONINFORMATION)
ProcedureReturn #True
EndProcedure
Procedure LoadPrefs()
Shared sSourcePath$
Shared sDestinationPath$
If ReadFile(#PREFS_File, ExePath() + "ERUPLLDE_Fixer.prefs")
sSourcePath$ = ReadString()
sDestinationPath$ = ReadString()
CloseFile(#PREFS_File)
EndIf
EndProcedure
Procedure SavePrefs()
Shared sSourcePath$
Shared sDestinationPath$
Debug sSourcePath$
Debug sDestinationPath$
Debug ExePath() + "ERUPLLDE_Fixer.prefs"
CreateFile(#PREFS_File, ExePath() + "ERUPLLDE_Fixer.prefs")
CloseFile(#PREFS_File)
If OpenFile(#PREFS_File, ExePath() + "ERUPLLDE_Fixer.prefs") <> 0
Debug ExePath() + "ERUPLLDE_Fixer.prefs"
Debug sSourcePath$
Debug sDestinationPath$
WriteStringN(sSourcePath$)
WriteStringN(sDestinationPath$)
CloseFile(#PREFS_File)
EndIf
EndProcedure