PBOSL - A OpenSource Library-Collection for PureBasic

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

@Padde
Thanks for the bugreport! These functions are old ones from PB3.94 :wink:
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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Padde
New User
New User
Posts: 5
Joined: Wed Apr 11, 2007 2:56 am

Post 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 :cry:



######### 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 :shock:

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 :evil:

Just now i try a workaround with 2 Ansi2Uni procedures one for each
Load procedure....
Last edited by Padde on Wed Apr 11, 2007 6:52 pm, edited 1 time in total.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Padde
New User
New User
Posts: 5
Joined: Wed Apr 11, 2007 2:56 am

Post by Padde »

This one fails in all cases.. MSXML3_Load and MSXML3_LoadXML both throw
an invalid memory access error
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

the function itself works for me, but i have inform the author (kiffi) to solve these problems
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Jacobus
User
User
Posts: 88
Joined: Wed Nov 16, 2005 7:51 pm
Location: France
Contact:

Post 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 
PureBasicien tu es, PureBasicien tu resteras.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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)
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Jacobus
User
User
Posts: 88
Joined: Wed Nov 16, 2005 7:51 pm
Location: France
Contact:

Post 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.
PureBasicien tu es, PureBasicien tu resteras.
User avatar
Psychophanta
Addict
Addict
Posts: 4975
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Post by Psychophanta »

I don't find exDatabase in the PBOSL pack, where is it?
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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
Last edited by ts-soft on Fri Jun 01, 2007 2:17 pm, edited 1 time in total.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

TS, you cannot "found" a bug... :lol:
PB 4.30

Code: Select all

onErrorGoto(?Fred)
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

AND51 wrote:TS, you cannot "found" a bug... :lol:
My bad english :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Hi ts-soft! I'm gonna test this lib right away and report any problems. Thanks!
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Post Reply