Desktop Functions: Smart Device Functions:
|
Search Results for "Marshalling " in [All]user32
/// we don't have to do any special marshalling here. Much InterfacesmscorsnRequires manual marshalling of parameters. The Size parameters refer to the length of the buffer in bytes, though the buffers contain Unicode characters. setupapi
//Marshalling vars
//Marshalling vars advapi326: CredRead An alternate approach to this can be found at http://blogs.msdn.com/peerchan/pages/487834.aspx. However as presented that technique requires more manual marshalling and more work for the calling code. Custom Marshalling provide a self contained and caller transparent solution to this scenario, the returned Credentials object is fully managed without the need to worry about object lifetimes. Structures7: MEMORYSTATUS
// Alternate, Structure Version. This One Allows Correct Marshalling As A "ref" Parameter, 8: TRUSTEE
<Some Marshalling attribute here> ptstrName is actually a LPTSTR in windows API (whereas string in .NET is unicode), so a marshalling attribute is needed to make it work. ole32misc10: Comments One question: The APIs here appear to be machanically created from some other source - from things like "System.Windows.Forms.NativeMethods"? The functions are present, but not the structures and data types used in the params. Any plans to do a mechanical dump of the structures as well? The real magic of marshalling is getting the param types set up correctly, which for structures can be quite a pain. The marshalling restrictions are one problem, as well as which DLL is actually used. From the CF side, we usually do the dumb downed one to work on both desktop and device. glossary11: Marshalling
static extern TODO Marshalling (TODO);
Declare Function Marshalling Lib "glossary.dll" (TODO) As TODO 12: Marshalling
Declare Function Marshalling Lib "glossary.dll" (TODO) As TODO kernel3213: CloseHandle I understand the conversion between 1 to 4 bytes for the different types of bools. However, isn't [MarshalAs(UnmanagedType.Bool)] the default for marshalling a .NET bool? Therefore making it unnecessary to specify any marshal on the return value. Please let me know if I'm wrong about this. 14: GetProcAddress GetProcAddress only comes in an ANSI flavor, hence we help the runtime by telling it to always use ANSI when marshalling the string parameter. We also prevent the runtime looking for a non-existent GetProcAddressA, because the default for C# is to set ExactSpelling to false. Should the marshalling not be: <MarshalAs(UnmanagedType.LPWStr)> Otherwise lpBuffer will be converted to Ansi and then passed to a Unicode API method. |