DroopyLib

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

Frontier wrote:Any plans to provide a library for the 64-bit version of PureBasic?
I have no plan for x64 yet.
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

22/07/11 : Library 4.51.008

Code: Select all

MozillaPreferenceLoad() added
MozillaPreferenceSave() added
MozillaPreferenceSet() added
MozillaPreferenceGet() added
MozillaPreferencePrejsJsPath() added
MozillaPath() added
MozillaExtensionName() added
MozillaExtensionVersion() added
ruslanx
User
User
Posts: 46
Joined: Mon Jun 06, 2011 8:28 am

Re: DroopyLib

Post by ruslanx »

error with WMI (droopy lib) ,when I compile with unicode ... WMI give error : [ERROR] Invalid memory access. (Read error at address 0) ... why ?

Code: Select all

;{ WMI2 CONSTANT FUNCTIONS STRUCTURES
#VT_EMPTY = 0 
#VT_NULL = 1
#VT_I2 = 2
#VT_I4 = 3 
#VT_R4 = 4
#VT_R8 = 5
#VT_CY = 6
#VT_DATE = 7
#VT_BSTR = 8
#VT_DISPATCH = 9
#VT_ERROR = 10
#VT_BOOL = 11
#VT_VARIANT = 12
#VT_UNKNOWN = 13
#VT_DECIMAL = 14
#VT_I1 = 16 
#VT_UI1 = 17
#VT_UI2 = 18
#VT_UI4 = 19
#VT_I8 = 20
#VT_UI8 = 21
#VT_INT = 22
#VT_UINT = 23
#VT_VOID = 24
#VT_HRESULT = 25
#VT_PTR = 26
#VT_SAFEARRAY = 27
#VT_CARRAY = 28
#VT_USERDEFINED = 29
#VT_LPSTR = 30
#VT_LPWSTR = 31
#VT_RECORD = 36
#VT_INT_PTR = 37
#VT_UINT_PTR = 38 
#VT_FILETIME = 64 
#VT_BLOB = 65 
#VT_STREAM = 66 
#VT_STORAGE = 67 
#VT_STREAMED_OBJECT = 68 
#VT_STORED_OBJECT = 69 
#VT_BLOB_OBJECT = 70 
#VT_CF = 71 
#VT_CLSID = 72
#VT_VERSIONED_STREAM = 73
#VT_BSTR_BLOB = $FFF 
#VT_VECTOR = $1000 
#VT_ARRAY = $2000 
#VT_BYREF = $4000 
#VT_RESERVED = $8000 
#VT_ILLEGAL = $FFFF 
#VT_ILLEGALMASKED = $FFF 
#VT_TYPEMASK = $FFF 
#COINIT_MULTITHREAD = 0
#RPC_C_AUTHN_LEVEL_CONNECT = 2
#RPC_C_IMP_LEVEL_IDENTIFY = 2
#EOAC_NONE = 0
#RPC_C_AUTHN_WINNT = 10
#RPC_C_AUTHZ_NONE = 0
#RPC_C_AUTHN_LEVEL_CALL = 3
#RPC_C_IMP_LEVEL_IMPERSONATE = 3
#CLSCTX_INPROC_SERVER = 1
#wbemFlagReturnImmediately = 16
#wbemFlagForwardOnly = 32
#IFlags = #wbemFlagReturnImmediately + #wbemFlagForwardOnly
#WBEM_INFINITE = $FFFFFFFF
#VARIANT_FALSE = $0000 
#WMISeparator = "," 
;}

Structure BRECORD  
  pvRecord.l;
  IRecordInfo.l
EndStructure

Structure SIGNSCALE
  scale.b
  sign.b
EndStructure

Structure DECIMAL
  wReserved.w
  signscale.SIGNSCALE
  high32.l
  low64.Double
EndStructure
  
Structure pToVariant  
  a.l
  b.l
  c.l
  d.l
EndStructure

ProcedureDLL.l Ansi2Uni(string.s) ; Converts normal (Ansi) string To Unicode 
  *out = AllocateMemory(Len(string)*4) 
  MultiByteToWideChar_(#CP_ACP, 0, string, -1, *out, Len(string))  
  ProcedureReturn *out  
EndProcedure 

; ProcedureDLL.s Uni2Ansi(Pointer) ; Converts Unicode to normal (Ansi) string 
;   Buffer.s=Space(512)
;   WideCharToMultiByte_(#CP_ACP,0,Pointer,-1,@Buffer,512,0,0)
;   ProcedureReturn Buffer
; EndProcedure


Procedure.s ipf_Uni2Ansi(Pointer) ; Converts Unicode to normal (Ansi) string 
  Buffer.s=Space(512)
  WideCharToMultiByte_(#CP_ACP,0,Pointer,-1,@Buffer,512,0,0)
  ProcedureReturn Buffer
EndProcedure

ProcedureDLL.s Uni2Ansi(Pointer) ; Converts Unicode to normal (Ansi) string 
  ProcedureReturn ipf_Uni2Ansi(Pointer)
EndProcedure




Procedure.s WMI2(WMICommand.s) ; Interrogate WMI2 Database
  
  ;// MSDN : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/anch_wmi.asp
  
  ;- WMI2 Initialize
  CoInitializeEx_(0,#COINIT_MULTITHREAD)
  hres=CoInitializeSecurity_(0, -1,0,0,#RPC_C_AUTHN_LEVEL_CONNECT,#RPC_C_IMP_LEVEL_IDENTIFY,0,#EOAC_NONE,0)
  If hres <> 0: MessageRequester("ERROR", "unable to call CoInitializeSecurity", #MB_OK)
    CoUninitialize_()
    ProcedureReturn wmi$
  EndIf
  hres=CoCreateInstance_(?CLSID_WbemLocator,0,#CLSCTX_INPROC_SERVER,?IID_IWbemLocator,@loc.IWbemLocator)
  If hres <> 0: MessageRequester("ERROR", "unable to call CoCreateInstance", #MB_OK)
    loc\release()
    CoUninitialize_()
    ProcedureReturn wmi$
  EndIf
  hres=loc\ConnectServer(Ansi2Uni("root\cimv2"),0,0,0,0,0,0,@svc.IWbemServices)
  If hres <> 0: MessageRequester("ERROR", "unable to call IWbemLocator::ConnectServer", #MB_OK)
    [color=#FF0000]svc\release()[/color]
    loc\release()
    CoUninitialize_()
    ProcedureReturn wmi$
  EndIf
  hres=svc\queryinterface(?IID_IUnknown,@pUnk.IUnknown)
  hres=CoSetProxyBlanket_(svc,#RPC_C_AUTHN_WINNT,#RPC_C_AUTHZ_NONE,0,#RPC_C_AUTHN_LEVEL_CALL,#RPC_C_IMP_LEVEL_IMPERSONATE,0,#EOAC_NONE)
  If hres <> 0: MessageRequester("ERROR", "unable to call CoSetProxyBlanket", #MB_OK)
    svc\release()
    loc\release()
    CoUninitialize_()
    ProcedureReturn wmi$
  EndIf
  hres=CoSetProxyBlanket_(pUnk,#RPC_C_AUTHN_WINNT,#RPC_C_AUTHZ_NONE,0,#RPC_C_AUTHN_LEVEL_CALL,#RPC_C_IMP_LEVEL_IMPERSONATE,0,#EOAC_NONE)
  If hres <> 0: MessageRequester("ERROR", "unable to call CoSetProxyBlanket", #MB_OK)
    svc\release()
    loc\release()
    CoUninitialize_()
    ProcedureReturn wmi$
  EndIf
  pUnk\release()
  
  
  ;- CallData
  k=CountString(WMICommand,#WMISeparator)
  Dim wmitxt$(k)
  For i=0 To k
    wmitxt$(i) = Trim(StringField(WMICommand,i+1,#WMISeparator))
  Next
  
  hres=svc\ExecQuery(Ansi2Uni("WQL"),Ansi2Uni(wmitxt$(0)), #IFlags,0,@pEnumerator.IEnumWbemClassObject)
  If hres <> 0: MessageRequester("ERROR", "unable to call IWbemServices::ExecQuery", #MB_OK)
    svc\Release() 
    loc\Release() 
    pEnumerator\Release() 
    CoUninitialize_() 
    ProcedureReturn wmi$ 
  EndIf
  hres=pEnumerator\reset()
  Repeat
  hres=pEnumerator\Next(#WBEM_INFINITE, 1, @pclsObj.IWbemClassObject, @uReturn)
  For i=1 To k
    hres=pclsObj\get(Ansi2Uni(wmitxt$(i)), 0, @x.Variant, 0, 0)
    
    Type=x\vt
    
    Select Type
        
      Case 8200
        val.s=""
        nDim=SafeArrayGetDim_(x\lVal)
        SafeArrayGetUBound_(x\lVal, nDim, @plUbound)
        ;Dim rgVar(plUbound)
        For z=0 To plUbound
          SafeArrayGetElement_(x\lVal, @z, @rgVar)
          val.s=val.s+", "+ipf_Uni2Ansi(rgVar)
        Next
        val.s=Mid(val.s, 3, Len(val.s))
        
      Case 8195
        val.s=""
        nDim=SafeArrayGetDim_(x\scode)
        SafeArrayGetUBound_(x\scode, nDim, @plUbound)
        ;Dim rgVar(plUbound)
        For z=0 To plUbound
          SafeArrayGetElement_(x\scode, @z, @rgVar)
          val.s=val.s + ", " +  Str(rgVar) 
        Next
        val.s=Mid(val.s, 3, Len(val.s))
        
      Case 11
        If x\boolVal=0
          val.s="FALSE" 
        ElseIf x\boolVal=-1
          val.s="TRUE"
        EndIf
        
      Case 8
        val.s=ipf_Uni2Ansi(x\bstrVal)
        
      Case 3
        val.s=Str(x\lVal)
        
      Case 1
        val.s="n/a"
        
      Default
        val.s=""
        
    EndSelect
    If uReturn <> 0: wmi$=wmi$+wmitxt$(i)+" = "+val+Chr(10)+Chr(13): EndIf
  Next
Until uReturn = 0

;- Cleanup
svc\release()
loc\release()
pEnumerator\release()
pclsObj\release()
CoUninitialize_()
ProcedureReturn wmi$

EndProcedure




MessageRequester("WMI",WMI2("Select * FROM Win32_OperatingSystem,Name,CSDVersion,SerialNumber,RegisteredUser,Organization")) 



;- Data
DataSection
  CLSID_IEnumWbemClassObject:
  ;1B1CAD8C-2DAB-11D2-B604-00104B703EFD
  Data.l $1B1CAD8C
  Data.w $2DAB, $11D2
  Data.b $B6, $04, $00, $10, $4B, $70, $3E, $FD
  IID_IEnumWbemClassObject:
  ;7C857801-7381-11CF-884D-00AA004B2E24
  Data.l $7C857801
  Data.w $7381, $11CF
  Data.b $88, $4D, $00, $AA, $00, $4B, $2E, $24
  CLSID_WbemLocator:
  ;4590f811-1d3a-11d0-891f-00aa004b2e24
  Data.l $4590F811
  Data.w $1D3A, $11D0
  Data.b $89, $1F, $00, $AA, $00, $4B, $2E, $24
  IID_IWbemLocator:
  ;dc12a687-737f-11cf-884d-00aa004b2e24
  Data.l $DC12A687
  Data.w $737F, $11CF
  Data.b $88, $4D, $00, $AA, $00, $4B, $2E, $24
  IID_IUnknown:
  ;00000000-0000-0000-C000-000000000046
  Data.l $00000000
  Data.w $0000, $0000
  Data.b $C0, $00, $00, $00, $00, $00, $00, $46
  
EndDataSection

hres=loc\ConnectServer(Ansi2Uni("root\cimv2"),0,0,0,0,0,0,@svc.IWbemServices)
If hres <> 0: MessageRequester("ERROR", "unable to call IWbemLocator::ConnectServer", #MB_OK)
svc\release()
loc\release()
........
> purebasic 4.51(x86).
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

I don't use unicode and don't support unicode.
Sorry
ruslanx
User
User
Posts: 46
Joined: Mon Jun 06, 2011 8:28 am

Re: DroopyLib

Post by ruslanx »

can you fix it ,I need WMI (but in Unicode) .. thx.

ps: older version of droopy lib .. is working in unicode fine (Droopy Library v1.31.14 ) ... but I need some function from new Lib ..
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

Version 4.51.012 avalaible
29/08/11 : Library 4.51.012
UnixToMSDosDate() added
MSDosDateToUnix() added
UnZip() added
SevenSegmentLed() added
SevenSegmentLedSet() added
SevenSegmentLedGet() added
GetShortPathName() added
GetLongPathName() added
22/08/11 : Library 4.51.011
MSIEnumInit() added
MSIEnumNext() added
MSIEnum_ProductName() added
MSIEnum_Version() added
MSIEnum_Guid() added
MSIVersion() added
MSIGuid() added
08/08/11 : Library 4.51.010
UserShellFolder() Deleted (buggy)
ExpandEnvironmentString() added
ProfilePath() added
08/08/11 : Library 4.51.009
MozillaPreferencePrejsJsPath renamed MozillaPreferencePath
MozillaPreferenceBackup() added
User avatar
OldSkoolGamer
Enthusiast
Enthusiast
Posts: 150
Joined: Mon Dec 15, 2008 11:15 pm
Location: Nashville, TN
Contact:

Re: DroopyLib

Post by OldSkoolGamer »

Wow, do you EVER rest at all Droopy ? :shock: Lots of updates lately, been making lots of little demo programs just to test out the new library features.
trather
User
User
Posts: 29
Joined: Sun Nov 07, 2004 9:57 pm

Re: DroopyLib

Post by trather »

I am running PB 4.51 64bit and I love your lib. I was running the older verison and there were something that were not working so I finaly upgraded to the latest version but now when ever use any of the lib functions I get the following error:

Code: Select all

Linker error:
POLINK:fatal error:Corrupt Library:'.\Droopy.lib'
I have tried download it a couple of time and even clicked on the link in the help menu to get latest version and I keep getting the same error. How to I fix the error or does this version not run in PB 64bit?
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

This version is only for pb x32 (i use it with 7x64)
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

Version 4.60.004 avalaible
29/02/12 : Library 4.60.004
MozillaPreferencePath() bug fixed
NetUserEnum() bug fixed
Unicode2Ansi() help added
ErrorHandler Tips added
Match() added
ProgramFilenameEx() added
LogInitAuto() changed

31/01/12 : Library 4.60.003
UseInternalIni() Code & Help fixed
EditInternalIni() Code fixed & Parameter removed

15/11/11 : Library 4.60.002
DefaultUserProfile() added
Tips UserProfileEnum added
RegKeyExists() bug fixed / Thanks to Markus Ottiger
GetUserName() help changed
Ping() help changed
Oem help changed
Wow64DisableWow64FsRedirection() help changed
UserLoggedOn() Works with 7

10/11/11 : Library 4.60.001
RegGetValue() bug fixed / Thanks to Markus Ottiger

02/09/11 : Library 4.51.014
MSIEnumInit() bug fixed
MSIEnumNext() bug fixed
ComputerSerialNumber() Changed
MSI() Changed

30/08/11 : Library 4.51.013
UseInternalIni() remove optional parameter
UseInternalIni() remove optional parameter
Resource example changed
Amundo
Enthusiast
Enthusiast
Posts: 191
Joined: Thu Feb 16, 2006 1:41 am
Location: New Zealand

Re: DroopyLib

Post by Amundo »

Thanks for the update, Droopy.

I get "This file is no longer available." from the Dropbox site?
Win8.1, PB5.x, okayish CPU, onboard video card, fuzzy monitor (or is that my eyesight?)
"When the facts change, I change my mind" - John Maynard Keynes
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

my public folders in dropbox is suspended because droopy.exe is seen as a malware :evil:
I search a way to publish my library
Regards
jassing
Addict
Addict
Posts: 1774
Joined: Wed Feb 17, 2010 12:00 am

Re: DroopyLib

Post by jassing »

Droopy wrote:my public folders in dropbox is suspended because droopy.exe is seen as a malware :evil:
I search a way to publish my library
Regards
I'll give you ftp space on my website - pm if you want it.
User avatar
Bisonte
Addict
Addict
Posts: 1232
Joined: Tue Oct 09, 2007 2:15 am

Re: DroopyLib

Post by Bisonte »

Droopy wrote:... because droopy.exe is seen as a malware :evil:
...
I think it's the URLDownloadToFile_ API function.
And the Fileformat : .exe .... why not zip ?
PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
User avatar
KJ67
Enthusiast
Enthusiast
Posts: 218
Joined: Fri Jun 26, 2009 3:51 pm
Location: Westernmost tip of Norway

Re: DroopyLib

Post by KJ67 »

Using VirusTotal for a wide scan and then contact all that flag the file normally works well, at least with all main AV-companies. The updated is often out with the next update.
I have from lessons learned also started keeping a collection of old false positive that I re-scan after some time just to minimize the risk of getting my final flagged when released.

Personally I'v installed the VirusTotal Uplader in PureBasic menu so that I simply can click it and send any compilation in a fast and convenient way. It's no fun when I client calls after a few days when their AV start complaining about a potential mal-ware. :?
The best preparation for tomorrow is doing your best today.
Post Reply