????? ????? ??????? ??????? ?????? ???????? ???? ???? ??? ????????? ??? ???? ??? ???? ??????? ???? ?????? Windows Server 2003 ?? ????? ????

?????? ????????? ?????? ?????????
???? ???????: 934234 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

????? ???

??? ???? ??????? ???? ?????? Windows Server 2003 ?? ????? ???? ?? Windows? ?? ???? ?????? ???? ????? ???? ??? ???? ????? ?? ??? ???????? iSCSI ????? ?????. ??? ????? ???? ?????? ???? Windows ?????? ??????? ??????? ?????? ???????. ?? ???? ?????? ?? ????? ??????? ??? ?????? ?? ????????? ??????? ???? ???? ??? ????????? ??? ????. ???? ??? ??????? ????? ????? ??? ????????? ?? ????? ??????.

??????? ????

??? ???? ???? ?????? ????????? ???? Windows ??????? ??? ?????? ?? ????? ??????. ????? ??????? ??? ??????? ?? ???? ?????. ??? ????? ?? ???? ??? ????? ???? ????? ?????? ??? ???? ????? (LUN) ??? ???? ????? ?? ??? ???????? iSCSI? ?????? ?? ?? ??????? ??? ???? ?????????. ??? ???? ??????? ?? ???? ????? ???? ???? ?????? ?? ?????? SCSI 0x80 ? 0x83.

?? ??? ??????? ?? ????? ??????? ??? ??????? ??????? ???? ?? ?? ???? ??? ????. ??? ??? ?????? ???? ????????? ????? ?? ???????? ???? ??? ????????? ?????? ??????? ?? ????? ??????. ??? ???? ??????? ????? ???????? ????? ?????? ??????? ???????? ??? ????? ????? ?????? ?? ???? ????? ??? ????? ?????? 10,001.

??? ??? ????? ?? ????? ??????? ????????? ?? ????? ??? ????? ??????? ?????? ?? ????? ????? ???? ?????? ???? ??????? ??????? ???? ?? ??? ???????. ????? ?????? ???? ???????? ?????????? ??????????? ?????? ????????.

????? ???? ??? Windows Server 2003 ?? Windows Server 2008? ???? ??????? Windows Server 2008 R2 ?? Visual Studio 2005

???? ????? ? GUID_DEVCLASS_DISKDRIVE ????? ????? GUID GUID_DEVCLASS_VOLUME ????? ??? ?????? ?????? ???????? ???? ??????? ???????.

?????????? ???? ???????? ??????????????? ?????? ???? ??????. ??? ????? ???? ????????? ???????? ?? ?????? 7 ???????? ??????? ?????? ??????? ???.
  1. ??????? ???? ?????????????????? ?????? ??? ??????? ???? ??????? ??????? ?????? ???????.
  2. ??????? ???? ??????????????????? ?????? ??? ??????? ???? ??? ???? ?? ????? ???????.
  3. ??????? ???? CM_Get_DevNode_Status ?????? ?? ??? ???? ??????? ?????? ?????? ???? ???? ?????. ????? ?? ??? ???? ???? ?????? ????? CR_NO_SUCH_DEVINST ?? CR_NO_SUCH_VALUE.
  4. ???? ???????? ????? ???? ??????? ???? CM_Get_Device_ID ?????? ??? ???? ???? ?????? ???? ?????? ??? ????? ?????????.
  5. ?????? ??? ?????? ?????? ??????? ????? ???? ???? ???? ?? ?????? 1 ?????????? ?????? ???? ???? ???? ?? ?????? 2. ??????? ???? ?????????????????????? (DIF_REMOVE?...) ?????? ????????? ?? ???????.
  6. ??? ??????? ?? ???? ??????? ?? ??? ???????? ??????? ???? ??????????????????????????? ??????.
?????? ?? ??? ????? ?????????? ?? ???? ????? ????? ??? ??? ? GUID_DEVCLASS_DISKDRIVE ? GUID_DEVCLASS_VOLUME ??????? ????? Guid ?? ???? ??????? GUID_DEVCLASS_SCSIADAPTER ? GUID_DEVCLASS_VOLUMESNAPSHOT ????? Guid. ?????? ????? ??? ????? ????? ???????????????? ?? ????? ????????? ???????? ???????.

????? ???? ???? Win32 ??????? ?????? ?????? ??? ?????. ???????? ??? ???????? ???? ??? ???????.

???? Microsoft ??????? ???????? ??????? ???? ??? ?? ???? ???? ?????? ?? ?????. ??? ????? ??? ?????? ???????? ??????? ?????? ???????? ?? ???????? ???? ????. ????? ??? ??????? ??? ????? ??? ??? ??????? ???? ??? ????? ???????? ????????? ?????? ????????? ????????. ????? ?????? ????? ??? Microsoft ??? ????? ????? ????. ??? ???? ?? ?????? ?????? ??? ??????? ?????? ????? ?????? ?? ????? ??????? ?????? ??????? ?????.
  1. ?? Microsoft Visual Studio 2005? ???? ??? ???? ?? ??????? ??? ? ??? ?? ???? ??? ???????.
  2. ????? Visual c + +? ??? ?? ???? ??? Win32.
  3. ????? ???? ???? Win32? ???? ??? ??? ????? ?? ?? ??? ???? ??? ?? ???? ??? ?????.
  4. ???? ??? ????? ?? ???? ?????? ????? ??????? Win32 .
  5. ?? "?????? ??????"? ?? ?????? ??????? ?????????? ????? ?????? Cleanup.cpp??? ???? ??? ??? ????????? ????????.
  6. ??? ???? ???????? ???????? ???????:
    int _tmain(int argc, _TCHAR* argv[])
    {
    	return 0;
    }
    
  7. ??????? ????????? ???????? ???????? ?? ?????? 6 ?? ????????? ???????? ???????.
    /**************************************************************************************************/     
    /*                                                                                                */     
    /* Copyright (c) 2007 Microsoft Corporation.  All Rights Reserved                                 */     
    /*                                                                                                */     
    /**************************************************************************************************/     
    
    #pragma warning( disable : 4201 ) // nonstandard extension used : nameless strut/union
    
    #include <windows.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <stddef.h>
    #include <tchar.h>
    #include <setupapi.h>
    #include <cfgmgr32.h>
    #include <initguid.h>
    #include <devguid.h>
    
    #define SIZECHARS(x) (sizeof((x))/sizeof(TCHAR))
    #define arraysize(p) (sizeof(p)/sizeof((p)[0]))
    
    CONST GUID *DiskClassesToClean[2] = {
        &GUID_DEVCLASS_DISKDRIVE,
        &GUID_DEVCLASS_VOLUME
    };
    
    /**************************************************************************************************/
    /*                                                                                                */
    /* The user must be member of Administrator group and must have backup and restore permissions         */
    /* (SE_BACKUP_NAME and SE_RESTORE_NAME). No check for these is performed in this example.              */
    /*                                                                                                */
    /**************************************************************************************************/
    int
    __cdecl
    main(
         IN int    ArgC,
         IN char * pArgV[]
        )
    {
        HDEVINFO DeviceInfoSet;
        SP_DEVINFO_DATA DeviceInfoData;
        ULONG DevicesRemoved = 0,
              i,
              MemberIndex,
              Status, 
              Problem,
              ulClassesToCleanIdx;
        BOOL bDoRemove = TRUE;
        CONFIGRET cr;
        TCHAR DeviceInstanceId[MAX_DEVICE_ID_LEN];
        OSVERSIONINFO osvi;
        const GUID ** ClassesToClean;
    
        //
        // Parse parameters.
        //
        for (i = 1; i < (ULONG)ArgC; i++) {
            //
            // Check for help.
            //
            if ( (lstrcmpi(pArgV[i], TEXT("-?")) == 0) ||
                    (lstrcmpi(pArgV[i], TEXT("/?")) == 0) ){
    
                printf("\nCleanUp will remove phantom storage device nodes from this machine.\n\n");
                printf("Usage:  CleanUp \n");
                printf("\twhere /n displays but does not remove the phantom devnodes.\n");
                printf("\nBackup and Restore privileges are required to run this utility.\n");
                return 0;
            }
    
            //
            // Check for -n, which means just list the devices that we would remove.
            //
            if ( (lstrcmpi(pArgV[i], TEXT("-n")) == 0) ||
                 (lstrcmpi(pArgV[i], TEXT("/n")) == 0) ) {
                bDoRemove = FALSE;
            }
        }
    
        //
        // Run only on Windows XP/2003 (version 5.1) or later.
        //
    
        ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
        osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    
        if (!GetVersionEx(&osvi)) {
            printf("CleanUp:  Unable to verify Windows version, exiting...\n");
            return -1;
        }
    
        if ((osvi.dwMajorVersion == 5) &&
            ((osvi.dwMinorVersion == 1) || (osvi.dwMinorVersion == 2))) {
        }
        else if (osvi.dwMajorVersion>=6) {
        }
        else
        {
            printf("CleanUp:  This utility is  designed to run on Windows XP/2003 and later\n");
            return -1;
        }
    
        ClassesToClean = DiskClassesToClean;
        ulClassesToCleanIdx = arraysize(DiskClassesToClean);
    
        for (i=0; (i<ulClassesToCleanIdx) && (bDoRemove); i++) {
    
            DeviceInfoSet = SetupDiGetClassDevs(ClassesToClean[i],
                                                NULL,
                                                NULL,
                                                0
                                                );
    
            if (INVALID_HANDLE_VALUE!=DeviceInfoSet) {
    
                DeviceInfoData.cbSize = sizeof(DeviceInfoData);
                MemberIndex = 0;
    
                while (SetupDiEnumDeviceInfo(DeviceInfoSet,
                                             MemberIndex++,
                                             &DeviceInfoData
                                             )) {
    
                    //
                    // Determine whether this device is a phantom.
                    //
                    cr = CM_Get_DevNode_Status(&Status,
                                               &Problem,
                                               DeviceInfoData.DevInst,
                                               0
                                               );
    
                    if ((cr == CR_NO_SUCH_DEVINST) ||
                        (cr == CR_NO_SUCH_VALUE)) {
                        //
                        // This is a phantom. Now get the DeviceInstanceId so we
                        // can display this as output, then delete the phantom if requested.
                        //
                        if (CM_Get_Device_ID(DeviceInfoData.DevInst,
                                             DeviceInstanceId,
                                             SIZECHARS(DeviceInstanceId),
                                             0) == CR_SUCCESS) {
    
                            if (bDoRemove) {
                                printf("DevNodePhantomCleaner:  %s will be removed.\n",
                                       DeviceInstanceId);
    
                                //
                                // Call DIF_REMOVE to remove the device's hardware
                                // and software registry keys.
                                //
                                if (SetupDiCallClassInstaller(DIF_REMOVE,
                                                              DeviceInfoSet,
                                                              &DeviceInfoData
                                                              )) {
                                    DevicesRemoved++;
                                } else {
                                    printf("CleanUp:  Error 0x%X removing phantom\n",
                                           GetLastError);
                                }
                            } else {
                                printf("CleanUp:  %s would have been removed.\n",
                                       DeviceInstanceId);
                            }
                        }
                    }
                }
    
                SetupDiDestroyDeviceInfoList(DeviceInfoSet);
            }
        }
    
        return DevicesRemoved;
    }
  8. ???? ??? ??????? ????? ? ??? ?? ???? ??? ??? ???????.

????? ????? Windows Server 2012 ? 2012 Studio ?????

?????? Windows Server 2012 ? Microsoft Visual Studio 2012? ???? ??????? ???????.

?????????? ???? ??????????????????????? ?????? ???? ??????. ??? ????? ???? ????????? ???????? ?? ?????? 7 ???????? ??????? ?????? ??????? ???.
  1. ?? Microsoft Visual Studio 2012? ????? ??? ???? ?? ??????? ??? ? ??? ?? ???? ??? ???????.
  2. ?? ???? ?????? " ????? ???? "? ???? ????? ?? ??? ?????? ??? ?? ???? ????? ??????? ??? ????? Win32.
  3. ?? ????? ??????? Win32? ???? ??? " ??????".
  4. ??? ??? ???????? ???? ??? ?????? <b00> </b00>"????? ???? ????"? ?? ???? ??? ?????.
  5. ?? "?????? ??????"? ?? ?????? ??????? ?????????? ????? ?????? Cleanup.cpp??? ???? ??? ??? ????????? ????????.
  6. ??? ???? ???????? ???????? ???????:
    int _tmain(int argc, _TCHAR* argv[])
    {
    	return 0;
    }
    
  7. ??????? ????????? ???????? ???????? ?? ?????? 6 ?? ????????? ???????? ???????.
    //DevPhantomClnr.cpp : Defines the entry point for the console application.
    // 
     
    #include "stdafx.h"
    
    /**************************************************************************************************/     
    /*                                                                                                */     
    /* Copyright (c) 2007 Microsoft Corporation.  All Rights Reserved                                 */     
    /*                                                                                                */     
    /**************************************************************************************************/     
    
    #pragma warning( disable : 4201 ) // nonstandard extension used : nameless strut/union
    
    #include <windows.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <stddef.h>
    #include <tchar.h>
    #include <setupapi.h>
    #include <cfgmgr32.h>
    #include <initguid.h>
    #include <devguid.h>
    
    #define SIZECHARS(x) (sizeof((x))/sizeof(TCHAR))
    #define arraysize(p) (sizeof(p)/sizeof((p)[0]))
    
    CONST GUID *DiskClassesToClean[2] = {
        &GUID_DEVCLASS_DISKDRIVE,
        &GUID_DEVCLASS_VOLUME
    };
    
    /**************************************************************************************************/
    /*                                                                                                */
    /* The user must be member of Administrator group and must have backup and restore permissions         */
    /* (SE_BACKUP_NAME and SE_RESTORE_NAME). No check for these is performed in this example.              */
    /*                                                                                                */
    /**************************************************************************************************/
    int
    __cdecl
    main(
         IN int    ArgC,
         IN LPCWSTR pArgV[]
        )
    {
        HDEVINFO DeviceInfoSet;
        SP_DEVINFO_DATA DeviceInfoData;
        ULONG DevicesRemoved = 0,
              i,
              MemberIndex,
              Status, 
              Problem,
              ulClassesToCleanIdx;
        BOOL bDoRemove = TRUE;
        CONFIGRET cr;
        TCHAR DeviceInstanceId[MAX_DEVICE_ID_LEN];
        OSVERSIONINFO osvi;
        const GUID ** ClassesToClean;
    
        //
        // Parse parameters.
        //
        for (i = 1; i < (ULONG)ArgC; i++) {
            //
            // Check for help.
            //
            if ( (lstrcmpi(pArgV[i], L"-?") == 0) ||
                    (lstrcmpi(pArgV[i], L"/?") == 0) ){
    
                printf("\nDevNodePhantomCleaner will remove phantom storage device nodes from this machine.\n\n");
                printf("Usage:  nDevNodePhantomCleaner \n");
                printf("\tWhere /n displays but does not remove the phantom devnodes.\n");
                printf("\nBackup and Restore privileges are required to run this utility.\n");
                return 0;
            }
    
            //
            // Check for -n, which means just list the devices that we would remove.
            //
            if ( (lstrcmpi(pArgV[i], L"-n") == 0) ||
                 (lstrcmpi(pArgV[i], L"/n") == 0) ) {
                bDoRemove = FALSE;
            }
        }
    
        //
        // Run only on Windows XP/2003 (version 5.1) or later.
        //
    
        ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
        osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    
        if (!GetVersionEx(&osvi)) {
            printf("DevNodePhantomCleaner:  Unable to verify Windows version, exiting...\n");
            return -1;
        }
    
        if ((osvi.dwMajorVersion == 5) &&
            ((osvi.dwMinorVersion == 1) || (osvi.dwMinorVersion == 2))) {
        
        // 5.1 || 5.2
    
        }
    
        else if (osvi.dwMajorVersion>=6) {
        
        //Nothing special on 6.x
    
        }
    
        else
        {
            printf("DevNodePhantomCleaner:  This utility is  designed to run on Windows XP/2003 and later\n");
            return -1;
        }
    
        ClassesToClean = DiskClassesToClean;
        ulClassesToCleanIdx = arraysize(DiskClassesToClean);
    
        for (i=0; (i<ulClassesToCleanIdx) && (bDoRemove); i++) {
    
            DeviceInfoSet = SetupDiGetClassDevs(ClassesToClean[i],
                                                NULL,
                                                NULL,
                                                0
                                                );
    
            if (INVALID_HANDLE_VALUE!=DeviceInfoSet) {
    
                DeviceInfoData.cbSize = sizeof(DeviceInfoData);
                MemberIndex = 0;
    
                while (SetupDiEnumDeviceInfo(DeviceInfoSet,
                                             MemberIndex++,
                                             &DeviceInfoData
                                             )) {
    
                    //
                    // Determine whether this device is a phantom.
                    //
                    cr = CM_Get_DevNode_Status(&Status,
                                               &Problem,
                                               DeviceInfoData.DevInst,
                                               0
                                               );
    
                    if ((cr == CR_NO_SUCH_DEVINST) ||
                        (cr == CR_NO_SUCH_VALUE)) {
                        //
                        // This is a phantom. Now get the DeviceInstanceId so we
                        // can display this as output, then delete the phantom if requested.
                        //
                        if (CM_Get_Device_ID(DeviceInfoData.DevInst,
                                             DeviceInstanceId,
                                             SIZECHARS(DeviceInstanceId),
                                             0) == CR_SUCCESS) {
    
                            if (bDoRemove) {
                                printf("DevNodePhantomCleaner:  %ws will be removed.\n",
                                       DeviceInstanceId);
    
                                //
                                // Call DIF_REMOVE to remove the device's hardware
                                // and software registry keys.
                                //
                                if (SetupDiCallClassInstaller(DIF_REMOVE,
                                                              DeviceInfoSet,
                                                              &DeviceInfoData
                                                              )) {
                                    DevicesRemoved++;
                                } else {
                                    printf("DevNodePhantomCleaner:  Error 0x%x removing phantom\n",
                                           GetLastError());
                                }
                            } else {
                                printf("DevNodePhantomCleaner:  %ws would have been removed.\n",
                                       DeviceInstanceId);
                            }
                        }
                    }
                }
    
                SetupDiDestroyDeviceInfoList(DeviceInfoSet);
            }
        }
    
        return DevicesRemoved;
    }
  8. ?? "?????? ??????"? ???? ??? ?????? ??? ?? ???? ??? ?????.
  9. ?? ?????? ????? ??????????? ?????? ???? ??? ???????.
  10. ????? ?????? ??????????? ??? ????? ????? ?? ??? ?????.
  11. ?? ???? ?????? ?????? ?????? ? ??? setupapi.lib ? cfgmgr32.lib.
  12. ???? ??? ????? ?????.
  13. ???? ???????.

???????

???? ???????: 934234 - ????? ??? ??????: 13/?????/1435 - ??????: 4.0
????? ???
  • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
  • Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
  • Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
  • Microsoft Windows Server 2003, Enterprise x64 Edition
  • Microsoft Windows Server 2003, Datacenter x64 Edition
  • Microsoft Windows Server 2003, Standard x64 Edition
  • Microsoft Windows Server 2003, Enterprise Edition for Itanium-based Systems
  • Microsoft Windows Server 2003, Datacenter Edition for Itanium-Based Systems
  • Microsoft Windows Server 2003 R2 Standard Edition (32-bit x86)
  • Microsoft Windows Server 2003 R2 Enterprise Edition (32-Bit x86)
  • Microsoft Windows Server 2003 R2 Datacenter Edition (32-Bit x86)
  • Microsoft Windows Server 2003 R2 Datacenter x64 Edition
  • Microsoft Windows Server 2003 R2 Enterprise x64 Edition
  • Microsoft Windows Server 2003 R2 Standard x64 Edition
  • Microsoft Windows Storage Server 2003 R2 x64 Enterprise
  • Microsoft Windows Storage Server 2003 R2 x64 Standard
  • Windows Server 2008 Datacenter
  • Windows Server 2008 Datacenter without Hyper-V
  • Windows Server 2008 Enterprise
  • Windows Server 2008 Enterprise without Hyper-V
  • Windows Server 2008 for Itanium-Based Systems
  • Windows Server 2008 Standard
  • Windows Server 2008 Standard without Hyper-V
  • Windows Server 2008 R2 Datacenter
  • Windows Server 2008 R2 Enterprise
  • Windows Server 2008 R2 Standard
  • Windows Server 2012 Standard
  • Windows Server 2012 Datacenter
????? ??????: 
kboem kbcode kbinfo kbhowto kbmt KB934234 KbMtar
????? ????
???: ??? ????? ??? ??????? ???????? ????? ?????????? ??????? ?????? ??? ??????? ?? ??? ??????? ?? ??????? ??? ??? ?? ???? ????????? ???? ??????? ???????(CTF) ?? ?? ???? ????? ????. ???? ?? ???? ?????????? ??? ???????? ???????? ???? ??? ?? ???????? ??????? ?? ??? ??????? ???????? ?? ??? ??????? ??????? ??? ?????? ?? ?????? ??? ???? ???????? ???????? ?? ????? ??????? ????? ????? ??????. ??? ?? ???????? ???????? ?? ????? ??? ????? ?? ???????? ?? ???? ????? ?? ?????. ?????? ??? ???? ?????????? ???? ?????? ?? ??? ????? ?? ??? ??? ?? ??????? ?? ??? ????? ?? ???? ????? ????? ?? ????? ??????? ???? ?? ???????? ?? ??? ???????.
???? ??? ????? ??????? ?????? ??????????934234

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com