Skip to content

Commit

Permalink
消灭26493警告。
Browse files Browse the repository at this point in the history
  • Loading branch information
kouzhudong committed Oct 27, 2023
1 parent efb4336 commit e9fa36c
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 27 deletions.
Binary file modified libnet/Adapter.cpp
Binary file not shown.
Binary file modified libnet/Firewall.cpp
Binary file not shown.
Binary file modified libnet/IOCTL.cpp
Binary file not shown.
Binary file modified libnet/NetApi.cpp
Binary file not shown.
16 changes: 8 additions & 8 deletions libnet/NetBIOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void ncbastat(void)
ncb.ncb_lana_num = 0;

memcpy(&ncb.ncb_callname, "* ", 16);
ncb.ncb_buffer = (UCHAR *)&Adapter;
ncb.ncb_buffer = reinterpret_cast<UCHAR *>(&Adapter);
ncb.ncb_length = sizeof(Adapter);

uRetCode = Netbios(&ncb);
Expand Down Expand Up @@ -160,17 +160,17 @@ BOOL NBListNames(int nLana, LPCSTR szName)

// Allocate the largest buffer that might be needed.
cbBuffer = sizeof(ADAPTER_STATUS) + 255 * sizeof(NAME_BUFFER);
pStatus = (ADAPTER_STATUS *)HeapAlloc(hHeap, 0, cbBuffer);
pStatus = reinterpret_cast<ADAPTER_STATUS *>(HeapAlloc(hHeap, 0, cbBuffer));
if (nullptr == pStatus)
return FALSE;

if (!NBAdapterStatus(nLana, (PVOID)pStatus, cbBuffer, szName)) {
if (!NBAdapterStatus(nLana, reinterpret_cast<PVOID>(pStatus), cbBuffer, szName)) {
HeapFree(hHeap, 0, pStatus);
return FALSE;
}

// The list of names follows the adapter status structure.
pNames = (NAME_BUFFER *)(pStatus + 1);
pNames = reinterpret_cast<NAME_BUFFER *>(pStatus + 1);

for (i = 0; i < pStatus->name_count; i++)
printf("\t%.*s\n", NCBNAMSZ, pNames[i].name);
Expand All @@ -187,12 +187,12 @@ BOOL NBAdapterStatus(int nLana, PVOID pBuffer, int cbBuffer, LPCSTR szName)

memset(&ncb, 0, sizeof(ncb));
ncb.ncb_command = NCBASTAT;
ncb.ncb_lana_num = (UCHAR)nLana;
ncb.ncb_lana_num = static_cast<UCHAR>(nLana);

ncb.ncb_buffer = (PUCHAR)pBuffer;
ncb.ncb_length = (WORD)cbBuffer;
ncb.ncb_buffer = static_cast<PUCHAR>(pBuffer);
ncb.ncb_length = static_cast<WORD>(cbBuffer);

MakeNetbiosName((char *)ncb.ncb_callname, szName);
MakeNetbiosName(reinterpret_cast<char *>(ncb.ncb_callname), szName);

Netbios(&ncb);
NBCheck(ncb);
Expand Down
8 changes: 4 additions & 4 deletions libnet/NetworkListManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ class MyNetWorkEvent : public INetworkListManagerEvents
{
HRESULT Result = S_OK;
if (IsEqualIID(riid, IID_IUnknown)) {
*ppvObject = (IUnknown *)this;
*ppvObject = dynamic_cast<IUnknown *>(this);
} else if (IsEqualIID(riid, IID_INetworkListManagerEvents)) {
*ppvObject = (INetworkListManagerEvents *)this;
*ppvObject = dynamic_cast<INetworkListManagerEvents *>(this);
} else {
Result = E_NOINTERFACE;
}
Expand All @@ -223,15 +223,15 @@ class MyNetWorkEvent : public INetworkListManagerEvents

virtual ULONG STDMETHODCALLTYPE AddRef(void)
{
return (ULONG)InterlockedIncrement(&m_ref);
return InterlockedIncrement(&m_ref);
}

virtual ULONG STDMETHODCALLTYPE Release(void)
{
LONG Result = InterlockedDecrement(&m_ref);
if (Result == 0)
delete this;
return (ULONG)Result;
return Result;
}

private:
Expand Down
Binary file modified libnet/Sock.cpp
Binary file not shown.
Binary file modified libnet/WebBrowser.cpp
Binary file not shown.
17 changes: 8 additions & 9 deletions libnet/Wlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Windows Server 2008 R2 if the Wireless LAN Service is not installed and started.
DWORD dwResult = 0;
int iRet = 0;
WCHAR GuidString[40] = {0};
int i{};

/* variables used for WlanEnumInterfaces */
PWLAN_INTERFACE_INFO_LIST pIfList = nullptr;
Expand All @@ -44,10 +43,10 @@ Windows Server 2008 R2 if the Wireless LAN Service is not installed and started.
} else {
wprintf(L"Num Entries: %lu\n", pIfList->dwNumberOfItems);
wprintf(L"Current Index: %lu\n", pIfList->dwIndex);
for (i = 0; i < (int)pIfList->dwNumberOfItems; i++) {
pIfInfo = (WLAN_INTERFACE_INFO *)&pIfList->InterfaceInfo[i];
for (DWORD i = 0; i < pIfList->dwNumberOfItems; i++) {
pIfInfo = reinterpret_cast<WLAN_INTERFACE_INFO *>(&pIfList->InterfaceInfo[i]);
wprintf(L" Interface Index[%d]:\t %ld\n", i, i);
iRet = StringFromGUID2(pIfInfo->InterfaceGuid, (LPOLESTR)&GuidString, 39);
iRet = StringFromGUID2(pIfInfo->InterfaceGuid, reinterpret_cast<LPOLESTR>(&GuidString), 39);
// For c rather than C++ source code, the above line needs to be
// iRet = StringFromGUID2(&pIfInfo->InterfaceGuid, (LPOLESTR) &GuidString, 39);
if (iRet == 0)
Expand Down Expand Up @@ -146,10 +145,10 @@ Note This example will fail to load on Windows Server 2008 and Windows Server 2
} else {
wprintf(L"Num Entries: %lu\n", pIfList->dwNumberOfItems);
wprintf(L"Current Index: %lu\n", pIfList->dwIndex);
for (i = 0; i < (int)pIfList->dwNumberOfItems; i++) {
pIfInfo = (WLAN_INTERFACE_INFO *)&pIfList->InterfaceInfo[i];
for (i = 0; i < pIfList->dwNumberOfItems; i++) {
pIfInfo = reinterpret_cast<WLAN_INTERFACE_INFO *>(&pIfList->InterfaceInfo[i]);
wprintf(L" Interface Index[%u]:\t %lu\n", i, i);
iRet = StringFromGUID2(pIfInfo->InterfaceGuid, (LPOLESTR)&GuidString,
iRet = StringFromGUID2(pIfInfo->InterfaceGuid, reinterpret_cast<LPOLESTR>(&GuidString),
sizeof(GuidString) / sizeof(*GuidString));
// For c rather than C++ source code, the above line needs to be
// iRet = StringFromGUID2(&pIfInfo->InterfaceGuid, (LPOLESTR) &GuidString,
Expand Down Expand Up @@ -207,7 +206,7 @@ Note This example will fail to load on Windows Server 2008 and Windows Server 2

wprintf(L" Num Entries: %lu\n\n", pBssList->dwNumberOfItems);
for (j = 0; j < pBssList->dwNumberOfItems; j++) {
pBssEntry = (WLAN_AVAILABLE_NETWORK *)&pBssList->Network[j];
pBssEntry = reinterpret_cast<WLAN_AVAILABLE_NETWORK *>(&pBssList->Network[j]);

wprintf(L" Profile Name[%u]: %ws\n", j, pBssEntry->strProfileName);

Expand All @@ -216,7 +215,7 @@ Note This example will fail to load on Windows Server 2008 and Windows Server 2
wprintf(L"\n");
else {
for (k = 0; k < pBssEntry->dot11Ssid.uSSIDLength; k++) {
wprintf(L"%c", (int)pBssEntry->dot11Ssid.ucSSID[k]);
wprintf(L"%c", pBssEntry->dot11Ssid.ucSSID[k]);
}
wprintf(L"\n");
}
Expand Down
12 changes: 6 additions & 6 deletions libnet/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@ void init()
{
HMODULE hNtDLL = GetModuleHandle(TEXT("ntdll.dll"));
if (nullptr != hNtDLL) {
pNtCreateFile = (P_NT_CREATE_FILE)GetProcAddress(hNtDLL, "NtCreateFile");
pNtCreateFile = reinterpret_cast<P_NT_CREATE_FILE>(GetProcAddress(hNtDLL, "NtCreateFile"));
if (nullptr == pNtCreateFile) {
printf("没有找到NtCreateFile函数\n");
}

Ipv4AddressToStringW = (PRtlIpv4AddressToString)GetProcAddress(hNtDLL, "RtlIpv4AddressToStringW");
Ipv4AddressToStringW = reinterpret_cast<PRtlIpv4AddressToString>(GetProcAddress(hNtDLL, "RtlIpv4AddressToStringW"));
if (nullptr == Ipv4AddressToStringW) {
printf("没有找到RtlIpv4AddressToStringW函数\n");
}

Ipv4StringToAddressW = (RtlIpv4StringToAddressRoutine)GetProcAddress(hNtDLL, "RtlIpv4StringToAddressW");
Ipv4StringToAddressW = reinterpret_cast<RtlIpv4StringToAddressRoutine>(GetProcAddress(hNtDLL, "RtlIpv4StringToAddressW"));
if (nullptr == Ipv4StringToAddressW) {
printf("没有找到RtlIpv4StringToAddressW函数\n");
}

Ipv6AddressToStringW = (PRtlIpv6AddressToString)GetProcAddress(hNtDLL, "RtlIpv6AddressToStringW");
Ipv6AddressToStringW = reinterpret_cast<PRtlIpv6AddressToString>(GetProcAddress(hNtDLL, "RtlIpv6AddressToStringW"));
if (nullptr == Ipv6AddressToStringW) {
printf("没有找到RtlIpv6AddressToStringW函数\n");
}

Ipv6StringToAddressW = (RtlIpv6StringToAddressRoutine)GetProcAddress(hNtDLL, "RtlIpv6StringToAddressW");
Ipv6StringToAddressW = reinterpret_cast<RtlIpv6StringToAddressRoutine>(GetProcAddress(hNtDLL, "RtlIpv6StringToAddressW"));
if (nullptr == Ipv6StringToAddressW) {
printf("没有找到RtlIpv6StringToAddressW函数\n");
}

Ipv6AddressToStringA = (PRtlIpv6AddressToStringA)GetProcAddress(hNtDLL, "RtlIpv6AddressToStringA");
Ipv6AddressToStringA = reinterpret_cast<PRtlIpv6AddressToStringA>(GetProcAddress(hNtDLL, "RtlIpv6AddressToStringA"));
if (nullptr == Ipv6AddressToStringA) {
printf("没有找到RtlIpv6AddressToStringA函数\n");
}
Expand Down
Binary file modified libnet/html.cpp
Binary file not shown.
Binary file modified libnet/log.cpp
Binary file not shown.
Binary file modified libnet/pathping.cpp
Binary file not shown.
Binary file modified libnet/raw.cpp
Binary file not shown.
Binary file modified libnet/spi.cpp
Binary file not shown.
Binary file modified libnet/tcp.cpp
Binary file not shown.
Binary file modified libnet/tracert.cpp
Binary file not shown.
Binary file modified libnet/udp.cpp
Binary file not shown.
Binary file modified libnet/wfp.cpp
Binary file not shown.

0 comments on commit e9fa36c

Please sign in to comment.