Safely Remove Hardware

1. Invoke the Safely Remove Hardware Dialog:RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll2. First issue CM_Query_And_Remove_SubTree on the device node, and then follow up with CM_Request_Device_Eject on the device node. Note: use the device node for the USB storage device enumerated by the USB hub, not the volume device enumerated via USBSTOR. Approach overview 1. Open the device via…

1

How the system Finds and Loads Drivers

1. PnP device It has an electronic signature that bus driver can detect the new hardware 2. Legacy device Initiate the detection by invoking Add New Hardware Wizard. In the end, in both PnP and Legacy Device situation, system uses the same automatic registry and INF file process to load the right driver. Function driver:…


Display JPG in ATL

• Tools: VC2005 (ATL8.0) • 2 possible ways:1. using the OleLoadPicture function and the IPicture interfacehttp://msdn.microsoft.com/en-us/magazine/cc301454.aspx2. ATL CImage Classhttp://msdn.microsoft.com/en-us/library/bwea7by5(VS.80).aspxCImage calls GDIPlus in the end… Gdiplus.dll is included with Windows XP, which is also included in Win2000SP4. • How to package the ActiveX ATL in a Web page1. Use the depends.exe to check dependency2. Pack VC2005…


PnP Device Installation

1. Plug the device into the computer.2. The device is enumerated. the bus driver notifies the kernel-mode PnP manager that the list of devices on the bus has changed. The Kernel-mode PnP manager sends IRPs(IRP_MN_QUERY_ID, IRP_MN_QUERY_CAPABILITIES) to bus driver to gather information about the new device, such as HadwardID, CompatibleIDs and device capabilities.3. The kernel_mode…


Composite USB device

Composite USB device   A device that contains more than one interface descriptor is known as a composite USB device. Each interface in a composite USB device is numbered.   http://msdn.microsoft.com/en-us/library/ms794302.aspx USB Device Stack for Windows XP and Later   The PCI bus driver enumerates the USB host controllers in the system and creates a…


USB Device ENUMERATION PROCESS

( Copy From Microchip AN1003) The following summarizes the steps involved in theenumeration of a USB device and explains how thedevice goes from Powered to Default, Address and theConfigured state during the enumeration process. 1. User plugs a USB device into a USB port. The hub provides power to the port and the device isin…


Error LNK2019: unresolved external symbol "char * __stdcall _com_util::ConvertBSTRToString(wchar_t *)"

Error 2 error LNK2019: unresolved external symbol “char * __stdcall _com_util::ConvertBSTRToString(wchar_t *)” (?ConvertBSTRToString@_com_util@@YGPADPA_W@Z) referenced in function “public: char const * __thiscall _bstr_t::Data_t::GetString(void)const ” (?GetString@Data_t@_bstr_t@@QBEPBDXZ) main.obj CPUTest I met this error when programming a WMI C++ query application. Research:MSDN Says :When calling a function in a static library or DLL that takes a wchar_t type (note…


How to get you NIC MAC address

Here is a good reference, Thanks Khalid!http://www.codeguru.com/Cpp/I-N/network/networkinformation/article.php/c5451/ Here is my code, just a little modification on Khaild’s:  


Banned API in Windows

http://download.microsoft.com/download/2/e/b/2ebac853-63b7-49b4-b66f-9fd85f37c0f5/banned.h/**** banned.h – list of Microsoft Security Development Lifecycle banned APIs** Purpose:* This include file contains a list of banned API which should not be used in new code and* removed from legacy code over time* History* 01-Jan-2006 – mikehow – Initial Version* 22-Apr-2008 – mikehow – Updated to SDL 4.1, commented out recommendations and…