WINAPI - How to marshall SetupCopyOEMInf arguments?

  • Thread starter Thread starter Ed Sutton
  • Start date Start date
E

Ed Sutton

How do I marshall the data types for a C# call to SetupCopyOEMInf?
Specifically PCTSTR, PDWORD, and PTSTR data types.


BOOL WINAPI SetupCopyOEMInf(
PCTSTR SourceInfFileName,
PCTSTR OEMSourceMediaLocation,
DWORD OEMSourceMediaType,
DWORD CopyStyle,
PTSTR DestinationInfFileName,
DWORD DestinationInfFileNameSize,
PDWORD RequiredSize,
PTSTR DestinationInfFileNameComponent
);

Here's what I have so far. Am I getting close?

[DllImport("setupapi.dll")]
static extern bool SetupCopyOEMInfA(

[MarshalAs(UnmanagedType.LPTStr)]
string sourceInfFileName,

[MarshalAs(UnmanagedType.LPTStr)]
string oEMSourceMediaLocation ,

System.UInt32 OEMSourceMediaType,

System.UInt32 copyStyle,

[MarshalAs(UnmanagedType.LPTStr)]
string destinationInfFileName,

int destinationInfFileNameSize,

System.Intptr requiredSize,

[MarshalAs(UnmanagedType.LPTStr)]
string destinationInfFileNameComponent);
}


I found this table which was helpful:

http://msdn.microsoft.com/library/d...cpguide/html/cpconplatforminvokedatatypes.asp


Thanks in advance for any tips or suggestions,

-Ed
 
Back
Top