Thread Permissions for Windows Embedded CE 6.0 Driver Migration
1/6/2010
In Windows CE 5.0 and earlier, process server libraries had access to the buffer of a caller since execution took place in the context of the caller's thread. Other threads, such as ISTs did not have access to the buffer of the caller and had to call the SetProcPermissionsfunction to set the internal permissions bitmask for the thread. This enabled access to the address space of the caller's process. The SetProcPermissions function is no longer supported in Windows Embedded CE 6.0, and should be removed from a driver. The CeAllocAsynchronousBuffer function marshals the buffer of the caller into the virtual memory of the kernel. This eliminates the need to change the permission of the thread.
In Windows CE 5.0, a driver would save the permissions of a calling process and then set the driver's thread permissions to include the calling process, when needed. After the calling process finished, the driver's thread permissions would be reset. The following code example shows thread permissions for a driver in Windows Embedded CE 6.0.
// Pre-Windows Embedded CE 6.0
// In XXX_IOControl
g_callerThreadPermissions = GetProcPermissions();
// Some internal driver thread (probably an IST)
originalThreadPermissions = SetProcPermissions(g_callerThreadPermissions);
// Access g_pMappedEmbedded
SetProcPermissions(originalThreadPermissions);
// Now in Windows Embedded CE 6.0
// Just call CeAllocAsynchronousBuffer from the
// driver’s entry point
// The IST can always access the marshaled buffer.
See Also
Other Resources
Migrating a Windows Embedded CE Driver to Windows Embedded CE 6.0