Changeset 58651 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt
- Timestamp:
- Nov 10, 2015 4:33:48 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetLwf-win.cpp
r57831 r58651 189 189 NDIS_HANDLE hWorkItem; 190 190 #endif /* !VBOXNETLWF_SYNC_SEND */ 191 /** Name of underlying adapter */192 ANSI_STRING strMiniportName;193 191 /** MAC address of underlying adapter */ 194 192 RTMAC MacAddr; … … 203 201 /** true if the host wants the adapter to be in promisc mode */ 204 202 bool fHostPromisc; 203 /** Name of underlying adapter */ 204 char szMiniportName[1]; 205 205 } VBOXNETLWF_MODULE; 206 206 typedef VBOXNETLWF_MODULE *PVBOXNETLWF_MODULE; … … 775 775 AssertReturn(pGlobals, NDIS_STATUS_FAILURE); 776 776 777 ANSI_STRING strMiniportName; 778 /* We use the miniport name to associate this filter module with the netflt instance */ 779 NTSTATUS rc = RtlUnicodeStringToAnsiString(&strMiniportName, 780 pParameters->BaseMiniportName, 781 TRUE); 782 if (rc != STATUS_SUCCESS) 783 { 784 Log(("ERROR! vboxNetLwfWinAttach: RtlUnicodeStringToAnsiString(%ls) failed with 0x%x\n", 785 pParameters->BaseMiniportName, rc)); 786 return NDIS_STATUS_FAILURE; 787 } 788 DbgPrint("vboxNetLwfWinAttach: friendly name=%wZ\n", pParameters->BaseMiniportInstanceName); 789 DbgPrint("vboxNetLwfWinAttach: name=%Z\n", strMiniportName); 790 791 UINT cbModuleWithNameExtra = sizeof(VBOXNETLWF_MODULE) + strMiniportName.Length; 777 792 PVBOXNETLWF_MODULE pModuleCtx = (PVBOXNETLWF_MODULE)NdisAllocateMemoryWithTagPriority(hFilter, 778 sizeof(VBOXNETLWF_MODULE),793 cbModuleWithNameExtra, 779 794 VBOXNETLWF_MEM_TAG, 780 795 LowPoolPriority); 781 796 if (!pModuleCtx) 797 { 798 RtlFreeAnsiString(&strMiniportName); 782 799 return NDIS_STATUS_RESOURCES; 800 } 783 801 Log4(("vboxNetLwfWinAttach: allocated module context 0x%p\n", pModuleCtx)); 784 802 785 NdisZeroMemory(pModuleCtx, sizeof(VBOXNETLWF_MODULE)); 803 NdisZeroMemory(pModuleCtx, cbModuleWithNameExtra); 804 NdisMoveMemory(pModuleCtx->szMiniportName, strMiniportName.Buffer, strMiniportName.Length); 805 RtlFreeAnsiString(&strMiniportName); 786 806 787 807 pModuleCtx->hWorkItem = NdisAllocateIoWorkItem(g_VBoxNetLwfGlobals.hFilterDriver); … … 793 813 return NDIS_STATUS_RESOURCES; 794 814 } 795 796 /* We use the miniport name to associate this filter module with the netflt instance */797 NTSTATUS rc = RtlUnicodeStringToAnsiString(&pModuleCtx->strMiniportName,798 pParameters->BaseMiniportName,799 TRUE);800 if (rc != STATUS_SUCCESS)801 {802 Log(("ERROR! vboxNetLwfWinAttach: RtlUnicodeStringToAnsiString(%ls) failed with 0x%x\n",803 pParameters->BaseMiniportName, rc));804 NdisFreeIoWorkItem(pModuleCtx->hWorkItem);805 NdisFreeMemory(pModuleCtx, 0, 0);806 return NDIS_STATUS_FAILURE;807 }808 DbgPrint("vboxNetLwfWinAttach: friendly name=%wZ\n", pParameters->BaseMiniportInstanceName);809 DbgPrint("vboxNetLwfWinAttach: name=%Z\n", pModuleCtx->strMiniportName);810 815 811 816 Assert(pParameters->MacAddressLength == sizeof(RTMAC)); … … 844 849 { 845 850 Log(("ERROR! vboxNetLwfWinAttach: NdisAllocateNetBufferListPool failed\n")); 846 RtlFreeAnsiString(&pModuleCtx->strMiniportName);847 851 NdisFreeIoWorkItem(pModuleCtx->hWorkItem); 848 852 NdisFreeMemory(pModuleCtx, 0, 0); … … 863 867 NdisFreeNetBufferListPool(pModuleCtx->hPool); 864 868 Log4(("vboxNetLwfWinAttach: freed NBL+NB pool 0x%p\n", pModuleCtx->hPool)); 865 RtlFreeAnsiString(&pModuleCtx->strMiniportName);866 869 NdisFreeIoWorkItem(pModuleCtx->hWorkItem); 867 870 NdisFreeMemory(pModuleCtx, 0, 0); … … 917 920 Log4(("vboxNetLwfWinDetach: freed NBL+NB pool 0x%p\n", pModuleCtx->hPool)); 918 921 } 919 RtlFreeAnsiString(&pModuleCtx->strMiniportName);920 922 NdisFreeIoWorkItem(pModuleCtx->hWorkItem); 921 923 NdisFreeMemory(hModuleCtx, 0, 0); … … 2127 2129 else 2128 2130 { 2129 DbgPrint("VBoxNetLwf: no saved offload config to modify for % Z\n", pModuleCtx->strMiniportName);2131 DbgPrint("VBoxNetLwf: no saved offload config to modify for %s\n", pModuleCtx->szMiniportName); 2130 2132 NdisZeroMemory(&OffloadConfig, sizeof(OffloadConfig)); 2131 2133 OffloadConfig.Header.Type = NDIS_OBJECT_TYPE_OFFLOAD; … … 2145 2147 } 2146 2148 else 2147 DbgPrint("VBoxNetLwf: no saved offload config to restore for % Z\n", pModuleCtx->strMiniportName);2149 DbgPrint("VBoxNetLwf: no saved offload config to restore for %s\n", pModuleCtx->szMiniportName); 2148 2150 } 2149 2151 } … … 2332 2334 AssertReturn(pThis, VERR_INVALID_PARAMETER); 2333 2335 Log(("vboxNetFltOsInitInstance: trunk name=%s\n", pThis->szName)); 2334 ANSI_STRING strInst;2335 RtlInitAnsiString(&strInst, pThis->szName);2336 2336 PVBOXNETLWF_MODULE pModuleCtx = NULL; 2337 2337 NdisAcquireSpinLock(&g_VBoxNetLwfGlobals.Lock); 2338 2338 RTListForEach(&g_VBoxNetLwfGlobals.listModules, pModuleCtx, VBOXNETLWF_MODULE, node) 2339 2339 { 2340 DbgPrint("vboxNetFltOsInitInstance: evaluating module, name=% Z\n", pModuleCtx->strMiniportName);2341 if ( RtlEqualString(&strInst, &pModuleCtx->strMiniportName, TRUE))2340 DbgPrint("vboxNetFltOsInitInstance: evaluating module, name=%s\n", pModuleCtx->szMiniportName); 2341 if (!RTStrICmp(pThis->szName, pModuleCtx->szMiniportName)) 2342 2342 { 2343 2343 NdisReleaseSpinLock(&g_VBoxNetLwfGlobals.Lock);
Note:
See TracChangeset
for help on using the changeset viewer.