Page 12 of 16
Posted: Wed Apr 11, 2007 10:19 am
by ts-soft
@Padde
Thanks for the bugreport! These functions are old ones from PB3.94
I will change 2 functions to this:
Code: Select all
Procedure.s MSXML3_Uni2Ansi(unicodestr.l)
; lenA = WideCharToMultiByte_(#CP_ACP, 0, unicodestr, -1, 0, 0, 0, 0);
; ansistr.s = Space(lenA)
; If (lenA > 0)
; WideCharToMultiByte_(#CP_ACP, 0, unicodestr, -1, @ansistr, lenA, 0, 0);
; EndIf
; ProcedureReturn ansistr
ProcedureReturn PeekS(unicodestr, #PB_Any, #PB_Ascii)
EndProcedure
Procedure.l MSXML3_Ansi2Uni(ansistr.s)
; lenA.l = Len(ansistr)
; lenW = MultiByteToWideChar_(#CP_ACP, 0, ansistr, lenA, 0, 0)
; If (lenW > 0) ; Check whether conversion was successful
; unicodestr = SysAllocStringLen_(0, lenW)
; MultiByteToWideChar_(#CP_ACP, 0, ansistr, lenA, unicodestr, lenW)
; result = unicodestr
; SysFreeString_(unicodestr)
; ProcedureReturn result
; Else
; ProcedureReturn 0
; EndIf
Protected unicodestr.s, len.l = StringByteLength(ansistr, #PB_Unicode)
unicodestr = Space(len + 2)
PokeS(@unicodestr, ansistr, #PB_Any, #PB_Unicode)
ProcedureReturn @unicodestr
EndProcedure
Can you test it
greetings
Thomas
Posted: Wed Apr 11, 2007 6:02 pm
by Padde
Both procedures didn't work.. but i could fix at least
the MSXML3_Uni2Ansi procedure.
This one do the job well
Code: Select all
Procedure.s MSXML3_Uni2Ansi(unicodestr.l)
; lenA = WideCharToMultiByte_(#CP_ACP, 0, unicodestr, -1, 0, 0, 0, 0);
; ansistr.s = Space(lenA)
; If (lenA > 0)
; WideCharToMultiByte_(#CP_ACP, 0, unicodestr, -1, @ansistr, lenA, 0, 0);
; EndIf
; ProcedureReturn ansistr
ProcedureReturn PeekS(unicodestr, #PB_Any, #PB_Unicode)
EndProcedure
The MSXML3_Ansi2Uni procedure always throws an invalid memory
access. Played a bit around with it.. but i was unable to force that bloody-minded peace of code to work
######### EDIT #########
This is getting realy weird... found out some sort of side-effect with
my previously posted MSXML3_Ansi2Uni fix.
If i use the untouched lib of pbosl loading files with MSXML3_Load is
working well.. even with big files... but loading via string with the
MSXML3_LoadXML procedure fails with string sizes above 16k
But thats not all... if i use the fixed MSXML3_Ansi2Uni procedure the
problem is exactly vice versa... loading files via string with
MSXML3_LoadXML is working well.. no matter what string sizes i use.
BUT.. yeah.. there is a but! MSXML3_Load fails on all file sizes.. what the
hell is going on
Just now i try a workaround with 2 Ansi2Uni procedures one for each
Load procedure....
Posted: Wed Apr 11, 2007 6:44 pm
by ts-soft
Okay, this should work:
Code: Select all
Procedure.l MSXML3_Ansi2Uni(ansistr.s)
Protected *out = AllocateMemory(StringByteLength(ansistr, #PB_Unicode) + 1)
If *out
PokeS(*out, ansistr, #PB_Any, #PB_Unicode)
ProcedureReturn *out
EndIf
EndProcedure
please test it again, thx
Posted: Wed Apr 11, 2007 6:58 pm
by Padde
This one fails in all cases.. MSXML3_Load and MSXML3_LoadXML both throw
an invalid memory access error
Posted: Wed Apr 11, 2007 7:06 pm
by ts-soft
the function itself works for me, but i have inform the author (kiffi) to solve these problems
Posted: Tue May 08, 2007 10:53 am
by Jacobus
Hi ts-soft, i have some problems with DBin lib to extract files of file.bin. (To add files it's work correctly) Can you test this code? It's a bug or one error of me? thanks.
Code: Select all
Global Dir$,key$
Dir$ = GetCurrentDirectory()
key$ = "MykeyMouse"
Procedure Gen_bin_File() ;to create test file
CreateINI = CreatePreferences(Dir$+"PARAM.ini")
If CreateINI <>0
WritePreferenceString("value1","Test of DBin lib")
WritePreferenceString("value2","DBin lib is good")
WritePreferenceString("value3","DBin lib is bad")
ClosePreferences()
Else
Debug "ERROR! INI is failed"
MessageRequester("ERROR!","INI is failed",#MB_ICONEXCLAMATION)
EndIf
If FileSize(Dir$+"PARAM.ini") <> -1
DBinfile = DBin_Create(Dir$+"DBfile.bin",0)
If DBinfile = 0
Debug "ERROR! DBin is failed"
MessageRequester("ERROR!","DBin is failed",#MB_ICONEXCLAMATION)
Else
Result = DBin_AddFile(Dir$+"DBfile.bin",Dir$+"PARAM.ini", key$,9)
If Result<>0
Debug "Addfile is done"
Delete = DeleteFile(Dir$+"PARAM.ini")
Else
Debug "ERROR! Add Param is failed"
MessageRequester("ERROR!","Add Param is failed",#MB_ICONEXCLAMATION)
EndIf
EndIf
EndIf
EndProcedure
Procedure Extract_bin_File() ;to extract file of bin
If FileSize(Dir$+"DBfile.bin")<> -1
totalfiles=DBin_TotalFiles(Dir$+"DBfile.bin")
For files=1 To totalfiles
file$=DBin_Dir(Dir$+"DBfile.bin",files) ; <------------ first method : no works!
Debug file$;<-------- return Dir$ !!
Next
;file$ = DBin_Dir(Dir$+"DBfile.bin",1) ; <------------ second method : no works!
;Debug file$ ;<-------- return Dir$ !!
TempF$ = Dir$+"PARAM.ini"
CopyF = DBin_SaveFile(Dir$+"DBfile.bin",file$,TempF$,key$) ; why not?
EndIf
If CopyF = 0
Debug "ERROR! Extract is failed!"
MessageRequester("ERROR!","Extract is failed!",16)
EndIf
EndProcedure
;-Test
Gen_bin_File()
Extract_bin_File()
If FileSize(Dir$+"DBfile.bin")<> -1
DeleteFile(Dir$+"DBfile.bin")
EndIf
Posted: Tue May 08, 2007 11:25 am
by ts-soft
@Jacobus
You use a absolute path for DBin_Dir, this doesn't work, please change to:
Code: Select all
file$=DBin_Dir("DBfile.bin",files)
Posted: Tue May 08, 2007 12:50 pm
by Jacobus
Thank you. In test code it's ok. I'll make another code for my app and change all paths...

Because the problem persist if the files are generated in a sub-folder. If the current directory is for example :
Dir\SubDir\DBin.bin The relative path doesn't work.
Posted: Wed May 09, 2007 3:24 pm
by Psychophanta
I don't find exDatabase in the PBOSL pack, where is it?
Posted: Wed May 09, 2007 3:31 pm
by ts-soft
Psychophanta wrote:I don't find exDatabase in the PBOSL pack, where is it?
Tailbite can't compile the source, SQLConfigDataSource_ doesn't work, but a new version is in progress.
http://www.purebasic.fr/german/viewtopi ... t=database
Posted: Fri Jun 01, 2007 1:50 pm
by ts-soft
PBOSL windows binaries recompiled for PB4.10
Please test this versions, but some libs doesn't work
Please tell me all bugs
Beta-Download:
http://ts-soft.eu/dl/pbosl_win.zip
regards
Thomas
Posted: Fri Jun 01, 2007 2:09 pm
by AND51
TS, you cannot "found" a bug...

Posted: Fri Jun 01, 2007 2:18 pm
by ts-soft
AND51 wrote:TS, you cannot "found" a bug...

My bad english

Posted: Sat Jun 02, 2007 8:00 am
by ts-soft
New Testversion of PBOSL_LoadDllMemory for PB4.10
Supports Unicode (without Subsystem)
New Function: GetModuleHandleM(hMemoryModule.l)
This handle is to use Resources in included DLL
Download with Source:
http://ts-soft.eu/dl/pbosl_loaddllmemory.zip
Posted: Sat Jun 02, 2007 8:32 am
by Inf0Byt3
Hi ts-soft! I'm gonna test this lib right away and report any problems. Thanks!