Freigeben über


How to Get PCMCIA Socket Information

The sample code performs the following steps:
Uses the IoGetDeviceObjectPointer function to obtain the device object and corresponding file object.
Initializes the PCMCIA_SOCKET_INFORMATION structure for the socket for which the information is sought.
Uses the IoBuildDeviceIoControlRequest function to allocate and set up an I/O request packet (IRP) for a device control request (the IOCTL_SOCKET_INFORMATION structure). This request should be sent at PASSIVE_LEVEL to the PCMCIA bus driver.
Passes the IRP down and waits for the result.

https://support.microsoft.com/kb/256161/en-us/

=============
This method is obsolete in Vista. Under Vista, PCMCIA device is no longer a named device object, (it's Securing Device Object now).

Maybe we can refer to “ntddpcm.h” under \winddk\version\inc\ddk, to turn on PCMCIA interface.

// Note: The IOCTL interface to pcmcia host controllers is turned off by
//       default. These IOCTLs are provided for testing purposes only. To
//       turn on this interface, add the following registry value:
// HKLM\SYSTEM\CurrentControlSet\Services\Pcmcia\Parameters\IoctlInterface : REG_DWORD : 1
//

#define IOCTL_PCMCIA_BASE                 FILE_DEVICE_CONTROLLER

#define DD_PCMCIA_DEVICE_NAME \\\\.\\Pcmcia

//
// IoControlCode values for this device.
//

#define IOCTL_GET_TUPLE_DATA         CTL_CODE(IOCTL_PCMCIA_BASE, 3000, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_SOCKET_INFORMATION     CTL_CODE(IOCTL_PCMCIA_BASE, 3004, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_PCMCIA_HIDE_DEVICE     CTL_CODE(IOCTL_PCMCIA_BASE, 3010, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_PCMCIA_REVEAL_DEVICE   CTL_CODE(IOCTL_PCMCIA_BASE, 3011, METHOD_BUFFERED, FILE_WRITE_ACCESS)

https://msdn.microsoft.com/en-us/library/ms789729.aspx
The PCMCIA IOCTL interface is enabled only if HKLM\SYSTEM\CurrentControlSet\Services\Pcmcia\Parameters\IoctlInterface (REG_DWORD) is set to 1. The IOCTL interface is turned off by default. This is valid for Windows XP, Windows Server 2003, Windows Vista, and Windows Server 2008.