From: Kerem Gümrükcü on
Yeah, nice, but how does it do that?
I am pretty sure, that it will work with
SetupDiGetDriverInfoDetail but for whatever
reason te call fails over .NET Layer...

Regards

Kerem

--
-----------------------
Beste Gr�sse / Best regards / Votre bien devoue
Kerem G�mr�kc�
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"Pavel A." <pavel_a(a)NOfastmailNO.fm> schrieb im Newsbeitrag
news:%23%23r$CKJ$IHA.2216(a)TK2MSFTNGP06.phx.gbl...
Command driverquery /SI lists drivers installed as _packages_
(using INFs).

--PA

Kerem G�mr�kc� wrote:
> Hi Don,
>
>> I do not know how to do it (never spent the time to figure it out) but it
>> can be done, since the driverquery command does exactly that.
>
> i run driverquery and it display the drivers name, its display name, its
> type
> and some time stamp information, but nothing for a INI, the drivers
> path,etc,...
>
> EnumDeviceDrivers returns all Drivers on the System, but how will i get
> the
> INI for that,...
>
> Regards
>
> Kerem
>

From: Don Burn on
No, they did it since size_t by the C standard can be 32 or 64 bits. There
was no definition that said a ULONG that is the size of the pointer.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply



"Pavel A." <pavel_a(a)NOfastmailNO.fm> wrote in message
news:e%23XS%23NJ$IHA.5048(a)TK2MSFTNGP05.phx.gbl...
> Don Burn wrote:
>> Which is why in various include files Microsoft created ULONG_PTR which
>> is 32 or 64 bit depending on the OS.
>
> Why they invented yet another name for size_t or ptrdiff_t ?
> It is also misleading, people (especially those raised on linux) tend to
> think that ULONG_PTR is pointer to ulong.
>
> --PA


From: Doron Holan [MSFT] on
my basic for interop code is that any pointer value you see will either be
an IntPtr or a ref <blittable struct>. a blittable struct is one that does
not contain any managed objects, only machine types and other structs (which
are also blittable).

in your case, the first parameter should be "out IntPtr lpImageBase" since
you will be treating the resulting address an opaque value

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Kerem G�mr�kc�" <kareem114(a)hotmail.com> wrote in message
news:e7PIJEI$IHA.2056(a)TK2MSFTNGP05.phx.gbl...
> Hi Don,
>
>>Well if you look at the sample in the SDK it is an LPVOID array. Using a
>>DWORD will get you in serious trouble on 64-bit.
>
> yes, you are right, thats why i wrote a wrapper arround the function, some
> call that first checks the size of the DWORD representation on the
> platform
> and then uses the right mannaged type to return the values,...
>
> BTW, the application is not written for the 64 bit systems, not yet but
> i am about to wrap all platform dependent stuff with wrappers. Thats
> a lot of work, so i will do it step-by-step. At this moment its for 32bit
> only,...
>
> Thanks for your reply!
>
>
> Regards
>
> Kerem
>
>
> --
> --
> -----------------------
> Beste Gr�sse / Best regards / Votre bien devoue
> Kerem G�mr�kc�
> Microsoft Live Space: http://kerem-g.spaces.live.com/
> Latest Open-Source Projects: http://entwicklung.junetz.de
> -----------------------
> "This reply is provided as is, without warranty express or implied."
>
> "Don Burn" <burn(a)stopspam.windrvr.com> schrieb im Newsbeitrag
> news:uXEZI4H$IHA.2216(a)TK2MSFTNGP06.phx.gbl...
>> Well if you look at the sample in the SDK it is an LPVOID array. Using
>> a
>> DWORD will get you in serious trouble on 64-bit.
>>
>>
>> --
>> Don Burn (MVP, Windows DDK)
>> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>> Website: http://www.windrvr.com
>> Blog: http://msmvps.com/blogs/WinDrvr
>> Remove StopSpam to reply
>>
>>
>>
>>
>> "Kerem G�mr�kc�" <kareem114(a)hotmail.com> wrote in message
>> news:OZleB1H$IHA.984(a)TK2MSFTNGP06.phx.gbl...
>> > Hi,
>> >
>> > just to make sure: What exactly is the size of a single element in
>> > the lpImageBase array that is returned by the EnumDeviceDrivers?
>> > Is it a DWORD? I guess so. I have to kno this because of translating
>> > the function to a .NET PInvoke call,...
>> >
>> > Regards
>> >
>> > Kerem
>> >
>> > --
>> > -----------------------
>> > Beste Gr�sse / Best regards / Votre bien devoue
>> > Kerem G�mr�kc�
>> > Latest Project: http://www.codeplex.com/restarts
>> > Latest Open-Source Projects: http://entwicklung.junetz.de
>> > -----------------------
>> > "This reply is provided as is, without warranty express or implied."
>>
>>
>
>

From: Kerem Gümrükcü on
Hi Doron,

here is my declaration that works fine for me (32bit), the
64bit is slightly different,...

[DllImport("psapi.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EnumDeviceDrivers(System.UInt32[] lpImageBase,
System.UInt32 cb,
out System.UInt32 lpcbNeeded);

i get the values by using:

lpImageBaseArray = new uint[lpcbNeeded / sizeof(uint)];

an then do a second call to get the ImageHandles. The first
call gets the size that i need

Sure, i can also use a IntPtr and then do the same with
Marshal-Class of the .NET Frameworl by allocating
Heap-Memory and working on it, but thats just fine,...

Works just fine in XP and Vista,...

Regards

Kerem

--
-----------------------
Beste Gr�sse / Best regards / Votre bien devoue
Kerem G�mr�kc�
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."

From: Doron Holan [MSFT] on
you can replace System.UInt32 [] with IntPtr[] and be portable and still
keep the same coding pattern

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Kerem G�mr�kc�" <kareem114(a)hotmail.com> wrote in message
news:%23CnZDbL$IHA.3392(a)TK2MSFTNGP03.phx.gbl...
> Hi Doron,
>
> here is my declaration that works fine for me (32bit), the
> 64bit is slightly different,...
>
> [DllImport("psapi.dll", SetLastError = true)]
> [return: MarshalAs(UnmanagedType.Bool)]
> public static extern bool EnumDeviceDrivers(System.UInt32[] lpImageBase,
> System.UInt32 cb,
> out System.UInt32 lpcbNeeded);
>
> i get the values by using:
>
> lpImageBaseArray = new uint[lpcbNeeded / sizeof(uint)];
>
> an then do a second call to get the ImageHandles. The first
> call gets the size that i need
>
> Sure, i can also use a IntPtr and then do the same with
> Marshal-Class of the .NET Frameworl by allocating
> Heap-Memory and working on it, but thats just fine,...
>
> Works just fine in XP and Vista,...
>
> Regards
>
> Kerem
>
> --
> -----------------------
> Beste Gr�sse / Best regards / Votre bien devoue
> Kerem G�mr�kc�
> Latest Project: http://www.codeplex.com/restarts
> Latest Open-Source Projects: http://entwicklung.junetz.de
> -----------------------
> "This reply is provided as is, without warranty express or implied."