lspdel.cpp File Reference#include "instlsp.h"
Include dependency graph for lspdel.cpp:
![]() Go to the source code of this file.
Function Documentation
Definition at line 202 of file lspdel.cpp. 00206 { 00207 INT ErrorCode, 00208 rc; 00209 00210 #ifdef _WIN64 00211 if ( LspCatalogBoth == Catalog ) 00212 { 00213 // Remove from 64-bit catalog 00214 rc = WSCDeinstallProvider( Guid, &ErrorCode ); 00215 if ( SOCKET_ERROR == rc ) 00216 { 00217 fprintf( stderr, "DeinstallProvider: WSCDeinstallProvider failed: %d\n", 00218 ErrorCode 00219 ); 00220 } 00221 00222 // Remove from the 32-bit catalog 00223 rc = WSCDeinstallProvider32( Guid, &ErrorCode ); 00224 if ( SOCKET_ERROR == rc ) 00225 { 00226 fprintf( stderr, "DeinstallProvider: WSCDeinstallProvider32 failed: %d\n", 00227 ErrorCode 00228 ); 00229 } 00230 } 00231 else if ( LspCatalog64Only == Catalog ) 00232 { 00233 // Remove from 64-bit catalog 00234 rc = WSCDeinstallProvider( Guid, &ErrorCode ); 00235 if ( SOCKET_ERROR == rc ) 00236 { 00237 fprintf( stderr, "DeinstallProvider: WSCDeinstallProvider failed: %d\n", 00238 ErrorCode 00239 ); 00240 } 00241 } 00242 else 00243 { 00244 // Remove from the 32-bit catalog 00245 rc = WSCDeinstallProvider32( Guid, &ErrorCode ); 00246 if ( SOCKET_ERROR == rc ) 00247 { 00248 fprintf( stderr, "DeinstallProvider: WSCDeinstallProvider32 failed: %d\n", 00249 ErrorCode 00250 ); 00251 } 00252 } 00253 #else 00254 if ( LspCatalog32Only == Catalog ) 00255 { 00256 // Remove from the 32-bit catalog 00257 rc = WSCDeinstallProvider( Guid, &ErrorCode ); 00258 if ( SOCKET_ERROR == rc ) 00259 { 00260 fprintf( stderr, "DeinstallProvider: WSCDeinstallProvider failed: %d\n", 00261 ErrorCode 00262 ); 00263 } 00264 } 00265 else 00266 { 00267 fprintf( stderr, "Unable to remove providers in 64-bit catalog from 32-bit process!\n" ); 00268 return SOCKET_ERROR; 00269 } 00270 #endif 00271 00272 return NO_ERROR; 00273 }
Definition at line 25 of file lspdel.cpp. 00028 { 00029 WSAPROTOCOL_INFOW *pProviders = NULL, 00030 *pAssociated = NULL; 00031 WCHAR szGuidString[ MAX_PATH ]; 00032 LSP_ENTRY *pLspMap = NULL; 00033 INT iProviderCount, 00034 iAssociatedCount, 00035 iMaxCount, 00036 iLspCount = 0, 00037 Status, 00038 rc, 00039 i, j, k; 00040 00041 Status = SOCKET_ERROR; 00042 00043 // First enumerate the catalog 00044 pProviders = EnumerateProviders( Catalog, &iProviderCount ); 00045 if ( NULL == pProviders ) 00046 { 00047 fprintf(stderr, "RemoveAllLayeredEntries: Unable to enumerate catalog!\n"); 00048 goto cleanup; 00049 } 00050 00051 // Build a mapping of the LSPs installed on the system 00052 pLspMap = BuildLspMap( pProviders, iProviderCount, &iLspCount ); 00053 if ( NULL == pLspMap ) 00054 { 00055 printf("\nNo LSPs to remove!\n"); 00056 goto cleanup; 00057 } 00058 00059 iMaxCount = MaxLayeredChainCount( pLspMap, iLspCount ); 00060 00061 pAssociated = (WSAPROTOCOL_INFOW *) LspAlloc( 00062 sizeof( WSAPROTOCOL_INFOW ) * iMaxCount, 00063 &rc 00064 ); 00065 if ( NULL == pAssociated ) 00066 { 00067 fprintf( stderr, "RemoveAllLayeredEntries: LspAlloc failed: %d\n", rc ); 00068 goto cleanup; 00069 } 00070 00071 printf( "\n%d LSPs installed:\n", iLspCount ); 00072 for(i=0; i < iLspCount ;i++) 00073 { 00074 if ( pLspMap[ i ].OrphanedEntries != TRUE ) 00075 { 00076 printf(" %d: %ws with %d layered entries\n", 00077 pLspMap[ i ].DummyEntry.dwCatalogEntryId, 00078 pLspMap[ i ].DummyEntry.szProtocol, 00079 pLspMap[ i ].Count 00080 ); 00081 } 00082 else 00083 { 00084 printf(" Orphaned LSP chain entries:\n"); 00085 for(j=0; j < pLspMap[ i ].Count ;j++) 00086 { 00087 printf("\t %d %ws\n", 00088 pLspMap[ i ].LayeredEntries[ j ].dwCatalogEntryId, 00089 pLspMap[ i ].LayeredEntries[ j ].szProtocol 00090 ); 00091 } 00092 } 00093 } 00094 00095 printf("\nRemoving LSPs...\n\n"); 00096 00097 for(i=0; i < iLspCount ;i++) 00098 { 00099 if ( pLspMap[ i ].OrphanedEntries != TRUE ) 00100 { 00101 // First remove the dummy entry 00102 printf( "Removing dummy entry for: %ws\n", pLspMap[ i ].DummyEntry.szProtocol ); 00103 00104 rc = DeinstallProvider( Catalog, &pLspMap[ i ].DummyEntry.ProviderId ); 00105 00106 if ( pLspMap[ i ].LayeredGuidCount > 0 ) 00107 printf("Removing the associated layered entries with GUIDs:\n"); 00108 00109 for(j=0; j < pLspMap[ i ].LayeredGuidCount ;j++) 00110 { 00111 StringFromGUID2( pLspMap[ i ].LayeredGuids[ j ], szGuidString, MAX_PATH-1 ); 00112 printf( "\tGUID: %ws\n", szGuidString ); 00113 00114 iAssociatedCount = iMaxCount; 00115 00116 // Get a list of all providers under this GUID so we can print it out 00117 rc = GetLayeredEntriesByGuid( 00118 pAssociated, 00119 &iAssociatedCount, 00120 pLspMap[ i ].LayeredEntries, 00121 pLspMap[ i ].Count, 00122 &pLspMap[ i ].LayeredGuids[ j ] 00123 ); 00124 if ( SOCKET_ERROR == rc ) 00125 { 00126 fprintf( stderr, "RemoveAllLayeredProviders: GetLayeredEntriesByGuid failed!\n" ); 00127 goto cleanup; 00128 } 00129 00130 for(k=0; k < iAssociatedCount ;k++) 00131 { 00132 printf("\t %d: %ws\n", 00133 pAssociated[ k ].dwCatalogEntryId, 00134 pAssociated[ k ].szProtocol 00135 ); 00136 } 00137 00138 rc = DeinstallProvider( Catalog, &pLspMap[ i ].LayeredGuids[ j ] ); 00139 if ( SOCKET_ERROR == rc ) 00140 { 00141 fprintf( stderr, "RemoveAllLayeredProviders: DeinstallProvider failed!\n" ); 00142 } 00143 else 00144 { 00145 printf( " Uninstalled providers for %ws\n", szGuidString ); 00146 } 00147 } 00148 } 00149 else 00150 { 00151 printf("Removing the following orphaned entries:\n"); 00152 for(j=0; j < pLspMap[ i ].Count ;j++) 00153 { 00154 printf("\t %d: %ws\n", 00155 pLspMap[ i ].LayeredEntries[ j ].dwCatalogEntryId, 00156 pLspMap[ i ].LayeredEntries[ j ].szProtocol 00157 ); 00158 } 00159 00160 for(j=0; j < pLspMap[ i ].LayeredGuidCount ;j++) 00161 { 00162 StringFromGUID2( pLspMap[ i ].LayeredGuids[ j ], szGuidString, MAX_PATH-1 ); 00163 00164 rc = DeinstallProvider( Catalog, &pLspMap[ i ].LayeredGuids[ j ] ); 00165 if ( SOCKET_ERROR == rc ) 00166 { 00167 fprintf( stderr, "RemoveAllLayeredProviders: DeinstallProvider failed!\n"); 00168 } 00169 else 00170 { 00171 printf("\tUninstalled providers for %ws\n", szGuidString ); 00172 } 00173 } 00174 } 00175 } 00176 00177 Status = NO_ERROR; 00178 00179 cleanup: 00180 00181 if ( NULL != pProviders ) 00182 FreeProviders( pProviders ); 00183 00184 if ( NULL != pLspMap ) 00185 FreeLspMap( pLspMap, iLspCount ); 00186 00187 if ( NULL != pAssociated ) 00188 LspFree( pAssociated ); 00189 00190 return Status; 00191 }
Definition at line 370 of file lspdel.cpp. 00374 { 00375 WSAPROTOCOL_INFOW *pProvider = NULL, 00376 *pLayeredEntries = NULL; 00377 LSP_ENTRY *pLspMap = NULL, 00378 *pLspMapEntryDel = NULL; 00379 DWORD *pdwCatalogOrder = NULL; 00380 INT iProviderCount = 0, 00381 iLayerCount = 0, 00382 iLspCount = 0, 00383 ErrorCode, 00384 Status, 00385 rc, 00386 i, j, k, l; 00387 00388 Status = SOCKET_ERROR; 00389 00390 // Enumerate the catalog 00391 pProvider = EnumerateProviders( Catalog, &iProviderCount ); 00392 if ( pProvider == NULL ) 00393 { 00394 fprintf( stderr, "RemoveProvider: Unable to enumerate catalog!\n" ); 00395 goto cleanup; 00396 } 00397 00398 // Allocate an array to save of the provider order in case we have to 00399 // do uninstall and reinstall providers 00400 pdwCatalogOrder = (DWORD *) LspAlloc( 00401 sizeof( DWORD ) * iProviderCount, 00402 &ErrorCode 00403 ); 00404 if ( NULL == pdwCatalogOrder ) 00405 { 00406 fprintf( stderr, "RemoveProvider: LspAlloc failed: %d\n", ErrorCode ); 00407 goto cleanup; 00408 } 00409 00410 for(i=0; i < iProviderCount ;i++) 00411 { 00412 pdwCatalogOrder[ i ] = pProvider[ i ].dwCatalogEntryId; 00413 } 00414 00415 // Build a map of the LSPs installed on the system 00416 pLspMap = BuildLspMap( pProvider, iProviderCount, &iLspCount ); 00417 if ( NULL == pLspMap ) 00418 { 00419 fprintf( stderr, "RemoveProvider: Unable to build LSP map!\n" ); 00420 goto cleanup; 00421 } 00422 00423 // Validate the catalog entry ID to remove 00424 pLspMapEntryDel = NULL; 00425 00426 for(i=0; ( i < iLspCount ) && ( NULL == pLspMapEntryDel ) ;i++) 00427 { 00428 if ( dwProviderId == pLspMap[ i ].DummyEntry.dwCatalogEntryId ) 00429 { 00430 pLspMapEntryDel = &pLspMap[ i ]; 00431 } 00432 else 00433 { 00434 for(j=0; j < pLspMap[ i ].Count ;j++) 00435 { 00436 if ( dwProviderId == pLspMap[ i ].LayeredEntries[ j ].dwCatalogEntryId ) 00437 { 00438 // In this case the user supplied the catalog ID of an LSP protocol 00439 // chain entry -- not the hidden layered entry (dummy). Here we'll 00440 // reset the dwProviderId to that of the dummy hidden entry. 00441 // 00442 if ( pLspMap[ i ].OrphanedEntries != TRUE ) 00443 { 00444 printf( "Catalog ID %d is a layered protocol entry and not the hidden\n" 00445 "provider representing the entire LSP. The LSP which owns this\n" 00446 "provider is ID %d (%ws). This entire LSP will be removed!\n", 00447 dwProviderId, 00448 pLspMap[ i ].DummyEntry.dwCatalogEntryId, 00449 pLspMap[ i ].DummyEntry.szProtocol 00450 ); 00451 dwProviderId = pLspMap[ i ].DummyEntry.dwCatalogEntryId; 00452 pLspMapEntryDel = &pLspMap[ i ]; 00453 } 00454 else 00455 { 00456 printf( "Catalog ID %d is one of %d orphaned protocol entries.\n" 00457 "These entries could be causing serious problems and\n" 00458 "will be removed. The following providers are to be\n" 00459 "deleted:\n", 00460 pLspMap[ i ].LayeredEntries[ j ].dwCatalogEntryId, 00461 pLspMap[ i ].Count 00462 ); 00463 for(k=0; k < pLspMap[ i ].Count ;k++) 00464 { 00465 printf(" %d: %ws\n", 00466 pLspMap[ i ].LayeredEntries[ k ].dwCatalogEntryId, 00467 pLspMap[ i ].LayeredEntries[ k ].szProtocol 00468 ); 00469 } 00470 pLspMapEntryDel = &pLspMap[ i ]; 00471 } 00472 break; 00473 } 00474 } 00475 } 00476 } 00477 00478 // Make sure we found a provider to remove 00479 if ( NULL == pLspMapEntryDel ) 00480 { 00481 fprintf( stderr, "\n\nError! Invalid Winsock catalog ID supplied: %d\n", 00482 dwProviderId 00483 ); 00484 goto cleanup; 00485 } 00486 00487 // 00488 // Print which entries are being removed 00489 // 00490 00491 printf( "\nThe following LSP entries will be removed:\n" ); 00492 if ( pLspMapEntryDel->OrphanedEntries != TRUE ) 00493 { 00494 printf( "LSP Hidden ID: %6d Name %ws\n", 00495 pLspMapEntryDel->DummyEntry.dwCatalogEntryId, 00496 pLspMapEntryDel->DummyEntry.szProtocol 00497 ); 00498 } 00499 else 00500 { 00501 printf( "Orphaned LSP protocol chain entries:\n"); 00502 } 00503 for(i=0; i < pLspMapEntryDel->Count ;i++) 00504 { 00505 printf( "LSP Layer ID: %6d Name %ws\n", 00506 pLspMapEntryDel->LayeredEntries[ i ].dwCatalogEntryId, 00507 pLspMapEntryDel->LayeredEntries[ i ].szProtocol 00508 ); 00509 } 00510 00511 printf( "\n\nTo remove press a key, otherwise CTRL+C now! "); 00512 getchar(); 00513 printf( "\n" ); 00514 00515 ErrorCode = NO_ERROR; 00516 00517 if ( 0 != pLspMapEntryDel->DependentCount ) 00518 { 00519 int iLspIdx; 00520 00521 printf( "\n\nOther LSPs are dependent on this one! " 00522 "Additional cleanup is required..\n\n" ); 00523 00524 for(i=0; i < pLspMapEntryDel->DependentCount ;i++) 00525 { 00526 iLspIdx = pLspMapEntryDel->DependentLspIndexArray[ i ]; 00527 00528 printf( "Fixing LSP index %d: %ws\n", 00529 pLspMap[ iLspIdx ].DummyEntry.dwCatalogEntryId, 00530 pLspMap[ iLspIdx ].DummyEntry.szProtocol 00531 ); 00532 00533 // Remove any reference to the deleted LSPs dummy catalog ID 00534 for(j=0; j < pLspMap[ iLspIdx ].Count ;j++) 00535 { 00536 if ( IsIdInChain( &pLspMap[ iLspIdx ].LayeredEntries[ j ], 00537 pLspMapEntryDel->DummyEntry.dwCatalogEntryId ) 00538 ) 00539 { 00540 printf( "Removing ID %d from layered chain %d: %ws\n", 00541 pLspMapEntryDel->DummyEntry.dwCatalogEntryId, 00542 pLspMap[ iLspIdx ].LayeredEntries[ j ].dwCatalogEntryId, 00543 pLspMap[ iLspIdx ].LayeredEntries[ j ].szProtocol 00544 ); 00545 00546 // Remove the deleted LSPs ID from the chain 00547 rc = RemoveIdFromChain( 00548 &pLspMap[ iLspIdx ].LayeredEntries[ j ], 00549 pLspMapEntryDel->DummyEntry.dwCatalogEntryId 00550 ); 00551 if ( FALSE == rc ) 00552 { 00553 fprintf( stderr, "RemoveProvider: ID not found in chain!\n" ); 00554 continue; 00555 } 00556 00557 pLspMap[ iLspIdx ].LayerChanged[ j ] = TRUE; 00558 } 00559 } 00560 00561 // Remove any reference to the deleted LSPs layered entries catalog 00562 // IDs from the layers of the dependent LSP 00563 for(l=0; l < pLspMapEntryDel->Count ;l++) 00564 { 00565 for(j=0; j < pLspMap[ iLspIdx ].Count ;j++) 00566 { 00567 if ( IsIdInChain( &pLspMap[ iLspIdx ].LayeredEntries[ j ], 00568 pLspMapEntryDel->LayeredEntries[ l ].dwCatalogEntryId ) 00569 ) 00570 { 00571 printf( "Removing ID %d from layered chain %d: %ws\n", 00572 pLspMapEntryDel->DummyEntry.dwCatalogEntryId, 00573 pLspMap[ iLspIdx ].LayeredEntries[ j ].dwCatalogEntryId, 00574 pLspMap[ iLspIdx ].LayeredEntries[ j ].szProtocol 00575 ); 00576 00577 // Remove the deleted LSPs ID from the chain 00578 rc = RemoveIdFromChain( 00579 &pLspMap[ iLspIdx ].LayeredEntries[ j ], 00580 pLspMapEntryDel->LayeredEntries[ l ].dwCatalogEntryId 00581 ); 00582 if ( FALSE == rc ) 00583 { 00584 fprintf( stderr, "RemoveProvider: ID not found in chain!\n" ); 00585 continue; 00586 } 00587 00588 pLspMap[ iLspIdx ].LayerChanged[ j ] = TRUE; 00589 } 00590 } 00591 } 00592 } 00593 00594 // 00595 // All dependent LSPs should no longer reference any of the LSPs IDs which is 00596 // to be removed. Now we must write our changes back to the catalog. Life 00597 // is easy if we're on a system that supports WSCUpdateProvider. 00598 // 00599 00600 if ( NULL != fnWscUpdateProvider ) 00601 { 00602 // 00603 // Life is good, simply call UpdateProvider on each entry in the LSP map 00604 // that was updated. 00605 // 00606 for(i=0; i < pLspMapEntryDel->DependentCount ;i++) 00607 { 00608 iLspIdx = pLspMapEntryDel->DependentLspIndexArray[ i ]; 00609 00610 for(j=0; j < pLspMap[ iLspIdx ].Count; j++) 00611 { 00612 if ( TRUE == pLspMap[ iLspIdx ].LayerChanged[ j ] ) 00613 { 00614 rc = UpdateProvider( 00615 Catalog, 00616 &pLspMap[ iLspIdx ].LayeredEntries[ j ].ProviderId, 00617 pLspMap[ iLspIdx ].wszLspDll, 00618 &pLspMap[ iLspIdx ].LayeredEntries[ j ], 00619 1, 00620 &ErrorCode 00621 ); 00622 } 00623 } 00624 } 00625 } 00626 else // fnWscUpdateProvider == NULL 00627 { 00628 int MaxLayers = 0; 00629 00630 // 00631 // Life isn't so good. We need to remove all dependent LSPs first in the 00632 // reverse order they were installed so that if something fails, we 00633 // won't leave the catalog in a bad state. Then we need to reinstall 00634 // them in the same order they were originally installed and fix any 00635 // of the remaining dependent LSPs to reference the correct catalog IDs 00636 // before they are also reinstalled. 00637 // 00638 00639 // Find the maximum protocol chain length of all the LSPs since we need 00640 // scratch space. We do the allocation first before making changes to 00641 // the catalog. 00642 MaxLayers = MaxLayeredChainCount( 00643 pLspMap, 00644 iLspCount 00645 ); 00646 00647 pLayeredEntries = (WSAPROTOCOL_INFOW *) LspAlloc( 00648 sizeof( WSAPROTOCOL_INFOW ) * MaxLayers, 00649 &ErrorCode 00650 ); 00651 if ( NULL == pLayeredEntries ) 00652 { 00653 fprintf( stderr, "RemoveProvider: LspAlloc failed: %d\n", 00654 ErrorCode ); 00655 goto cleanup; 00656 } 00657 00658 // Remove the dependent LSPs in reverse order. NOTE: We don't have to 00659 // remove the dummy hidden entries since there is no information 00660 // in those providers that need updating. 00661 for(i=0; i < pLspMapEntryDel->DependentCount ;i++) 00662 { 00663 iLspIdx = pLspMapEntryDel->DependentLspIndexArray[ i ]; 00664 00665 for(j=0; j < pLspMap[ iLspIdx ].LayeredGuidCount ;j++) 00666 { 00667 rc = DeinstallProvider( 00668 Catalog, 00669 &pLspMap[ iLspIdx ].LayeredGuids[ j ] 00670 ); 00671 if ( SOCKET_ERROR == rc ) 00672 { 00673 fprintf( stderr, 00674 "RemoveProvider: An error occured trying to remove an LSP.\n" 00675 "\t\tThis may be due to another process changing the Catalog\n" 00676 "\t\tAborting...\n" 00677 ); 00678 goto cleanup; 00679 } 00680 } 00681 } 00682 00683 // All the dependent LSP layers have been removed, now add them 00684 // back in reverse order 00685 for(i=pLspMapEntryDel->DependentCount-1; i >= 0 ;i--) 00686 { 00687 iLspIdx = pLspMapEntryDel->DependentLspIndexArray[ i ]; 00688 00689 // Install the layered entries 00690 for(j=0; j < pLspMap[ iLspIdx ].LayeredGuidCount ;j++) 00691 { 00692 iLayerCount = MaxLayers; 00693 00694 rc = GetLayeredEntriesByGuid( 00695 pLayeredEntries, 00696 &iLayerCount, 00697 pLspMap[ iLspIdx ].LayeredEntries, 00698 pLspMap[ iLspIdx ].Count, 00699 &pLspMap[ iLspIdx ].LayeredGuids[ j ] 00700 ); 00701 00702 rc = InstallProvider( 00703 Catalog, 00704 &pLspMap[ iLspIdx ].LayeredGuids[ j ], 00705 pLspMap[ iLspIdx ].wszLspDll, 00706 pLayeredEntries, 00707 iLayerCount 00708 ); 00709 00710 } 00711 00712 // Enumerate catalog to find new IDs 00713 00714 DWORD ProviderLen = iProviderCount * sizeof( WSAPROTOCOL_INFOW ); 00715 00716 int NewProviderCount = EnumerateProvidersExisting( 00717 Catalog, 00718 pProvider, 00719 &ProviderLen 00720 ); 00721 if ( SOCKET_ERROR == NewProviderCount ) 00722 { 00723 fprintf( stderr, "RemoveProvider: EnumerateProvidersExisting failed: %d\n", 00724 GetLastError() ); 00725 } 00726 00727 // Update the old references to the new 00728 MapNewEntriesToOld( 00729 &pLspMap[ iLspIdx ], 00730 pProvider, 00731 NewProviderCount 00732 ); 00733 00734 // Update the provider order array with the new provider values 00735 UpdateProviderOrder( 00736 &pLspMap[ iLspIdx ], 00737 pdwCatalogOrder, 00738 iProviderCount 00739 ); 00740 00741 // For the remaining LSPs which we still need to install, update any 00742 // references to the removed LSPs with their new IDs 00743 for(k=i-1; k >= 0 ;k--) 00744 { 00745 int iLspIdx2 = pLspMapEntryDel->DependentLspIndexArray[ k ]; 00746 00747 printf( "Updating IDs for index %d\n", iLspIdx2 ); 00748 00749 for(l=0; l < pLspMap[ iLspIdx ].Count ;l++) 00750 { 00751 UpdateLspMap( 00752 &pLspMap[ iLspIdx2 ], 00753 pLspMap[ iLspIdx ].LayeredEntries[ l ].dwCatalogEntryId, 00754 pLspMap[ iLspIdx ].LayeredEntries[ l ].dwProviderReserved 00755 ); 00756 } 00757 } 00758 } 00759 00760 // Reorder the catalog back to what it was before. Since we've added 00761 // back all the LSPs we removed earlier, the catalog should be the 00762 // same size as when we started. 00763 rc = WriteProviderOrder( 00764 Catalog, 00765 pdwCatalogOrder, 00766 iProviderCount, 00767 &ErrorCode 00768 ); 00769 if ( SOCKET_ERROR == rc ) 00770 { 00771 fprintf( stderr, "RemoveProvider: WriteProviderOrder failed: %d\n", 00772 ErrorCode ); 00773 } 00774 } 00775 } 00776 00777 // 00778 // Now all dependencies have been fixed, remove the specified provider 00779 // 00780 00781 // Remove the layered protocol entries 00782 for(i=0; i < pLspMapEntryDel->LayeredGuidCount ;i++) 00783 { 00784 rc = DeinstallProvider( 00785 Catalog, 00786 &pLspMapEntryDel->LayeredGuids[ i ] 00787 ); 00788 } 00789 00790 // Remove the dummy entry 00791 rc = DeinstallProvider( 00792 Catalog, 00793 &pLspMapEntryDel->DummyEntry.ProviderId 00794 ); 00795 00796 Status = NO_ERROR; 00797 00798 cleanup: 00799 00800 // 00801 // Cleanup allocations 00802 // 00803 00804 if ( NULL != pLayeredEntries ) 00805 LspFree( pLayeredEntries ); 00806 00807 if ( NULL != pProvider ) 00808 FreeProviders(pProvider); 00809 00810 if ( NULL != pLspMap ) 00811 FreeLspMap( pLspMap, iLspCount ); 00812 00813 if ( NULL != pdwCatalogOrder ) 00814 LspFree( pdwCatalogOrder ); 00815 00816 return Status; 00817 }
Definition at line 283 of file lspdel.cpp. 00291 { 00292 int rc = SOCKET_ERROR; 00293 00294 #ifdef _WIN64 00295 if ( LspCatalog64Only == Catalog ) 00296 { 00297 rc = fnWscUpdateProvider( 00298 ProviderId, 00299 DllPath, 00300 ProtocolInfoList, 00301 NumberOfEntries, 00302 lpErrno 00303 ); 00304 } 00305 else if ( LspCatalog32Only == Catalog ) 00306 { 00307 rc = fnWscUpdateProvider32( 00308 ProviderId, 00309 DllPath, 00310 ProtocolInfoList, 00311 NumberOfEntries, 00312 lpErrno 00313 ); 00314 } 00315 #else 00316 if ( LspCatalog32Only == Catalog ) 00317 { 00318 rc = fnWscUpdateProvider( 00319 ProviderId, 00320 DllPath, 00321 ProtocolInfoList, 00322 NumberOfEntries, 00323 lpErrno 00324 ); 00325 } 00326 else 00327 { 00328 fprintf( stderr, "UpdateProvider: Unable to manipulate 64-bit catalog from a 32" 00329 "-bit process\n" ); 00330 } 00331 #endif 00332 00333 if ( SOCKET_ERROR == rc ) 00334 { 00335 fprintf( stderr, "UpdateProvider: WSCUpdateProvider failed: %d\n", 00336 *lpErrno ); 00337 } 00338 00339 return rc; 00340 }
|