SetupAPI, Cfg+ headers (for PureBasic Community)
SetupAPI, Cfg+ headers (for PureBasic Community)
Last edited by Thunder93 on Sun Mar 27, 2016 9:27 pm, edited 1 time in total.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: SetupAPI header ported to PureBasic.
Small note:
You can save some lines by moving your Global Prototype defines inside Procedure setupapi_Init().
FROM:
Global SetupAddInstallSectionToDiskSpaceList.SetupAddInstallSectionToDiskSpaceList
;+ the following line in Procedure setupapi_Init()
SetupAddInstallSectionToDiskSpaceList = GetFunction(setupapi, "SetupAddInstallSectionToDiskSpaceList"+sExt)
TO:
Global SetupAddInstallSectionToDiskSpaceList.SetupAddInstallSectionToDiskSpaceList = GetFunction(setupapi, "SetupAddInstallSectionToDiskSpaceList"+sExt)
You can save some lines by moving your Global Prototype defines inside Procedure setupapi_Init().
FROM:
Global SetupAddInstallSectionToDiskSpaceList.SetupAddInstallSectionToDiskSpaceList
;+ the following line in Procedure setupapi_Init()
SetupAddInstallSectionToDiskSpaceList = GetFunction(setupapi, "SetupAddInstallSectionToDiskSpaceList"+sExt)
TO:
Global SetupAddInstallSectionToDiskSpaceList.SetupAddInstallSectionToDiskSpaceList = GetFunction(setupapi, "SetupAddInstallSectionToDiskSpaceList"+sExt)
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: SetupAPI header ported to PureBasic.
very good suggestion skywalk, thank you.
.. Updated it.
.. Updated it.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: SetupAPI header ported to PureBasic.
bool is 4 byte, boolean is 1 byte. you are using .b for both.
you should replace [#ANYSIZE_ARRAY] with [0]. if you want to access an index > 0 (and you usually will), the debugger will fire an "array index out of bounds" error. if you use [0], you can browse any index you want. the only drawback is that SizeOf() will report the wrong size, since 0 is nothing. so keep that in mind.
why are you using data types as names?
the original names make much more sense and increase the readability a lot.
c ya,
nco2k
you should replace [#ANYSIZE_ARRAY] with [0]. if you want to access an index > 0 (and you usually will), the debugger will fire an "array index out of bounds" error. if you use [0], you can browse any index you want. the only drawback is that SizeOf() will report the wrong size, since 0 is nothing. so keep that in mind.
why are you using data types as names?
Code: Select all
SetupAddInstallSectionToDiskSpaceList(HDSKSPC,HINF1,HINF2,PCSTR,PVOID,UINT.l)
Code: Select all
SetupAddInstallSectionToDiskSpaceList(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2.l)
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Re: SetupAPI header ported to PureBasic.
The "70% mistake" : Check the datatypes....
A long is not the variable for a handle. So this code is x86 only !
(See setupapi.l)
A long is not the variable for a handle. So this code is x86 only !
(See setupapi.l)
Re: SetupAPI header ported to PureBasic.
Thanks nco2k.
On a whim in the middle of the night, I've decided to convert setupapi C header. Few hours in, no coffee, and manually doing this all, my senses obviously been dulled. I couldn't exactly sleep when I tried, and I didn't have nothing better to-do, so I came to the computer and played around.
True, increased readability, to have names instead of data-types. I was planning on, at some point making this change anyways. However since much time spent onto this already, and I wasn't in the right frame of mind. I figured mistakes can be easier spotted, and replaced easily for the time being. When I do make this change, I'll probably have to spend another few hours just to lookup all the names and make the changes.
Updated the file.
On a whim in the middle of the night, I've decided to convert setupapi C header. Few hours in, no coffee, and manually doing this all, my senses obviously been dulled. I couldn't exactly sleep when I tried, and I didn't have nothing better to-do, so I came to the computer and played around.
True, increased readability, to have names instead of data-types. I was planning on, at some point making this change anyways. However since much time spent onto this already, and I wasn't in the right frame of mind. I figured mistakes can be easier spotted, and replaced easily for the time being. When I do make this change, I'll probably have to spend another few hours just to lookup all the names and make the changes.
Updated the file.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: SetupAPI header ported to PureBasic.
I think Its mostly the Prototype types that I messed up on, halfway into doing this. Corrected these, now it should be fully x64 compatible.
Last edited by Thunder93 on Fri Mar 18, 2016 4:11 pm, edited 1 time in total.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: SetupAPI header ported to PureBasic.
no worries, everyone makes mistakes. when i have to convert a lot winapi stuff, i copy everything into notepad++ and record some makros. great time saver.
btw what Bisonte was trying to say is that you should change:
to:
c ya,
nco2k
btw what Bisonte was trying to say is that you should change:
Code: Select all
Shared setupapi.l
Code: Select all
Shared setupapi.i
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Re: SetupAPI header ported to PureBasic.
Thanks nco2k. I've overlooked that part in Bisonte's post. @Bisonte: Good catch.
I have Notepad++ installed, however I've never explored its massive list of features. I'll have to look into this Macro recording.
file updated again.
I have Notepad++ installed, however I've never explored its massive list of features. I'll have to look into this Macro recording.
file updated again.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: SetupAPI header ported to PureBasic.
I've updated it.
Now using true names instead of data-types for parameter names..... @nco2k, better?
Added more prototypes. Now covers all Setup* functions from setupapi.
Now using true names instead of data-types for parameter names..... @nco2k, better?
Added more prototypes. Now covers all Setup* functions from setupapi.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley