--- q_a/samples/winnet/winnet.c 2018/08/09 18:29:19 1.1 +++ q_a/samples/winnet/winnet.c 2018/08/09 18:30:05 1.1.1.3 @@ -1,5 +1,8 @@ /****************************************************************************\ * +* Microsoft Developer Support +* Copyright (c) 1992, 1993 Microsoft Corporation +* * MODULE: winnet.c * * PURPOSE: Demonstrate the WNetXXX Win32 api(s) (10 of the 11 - all but @@ -115,14 +118,14 @@ /****************************************************************************\ * * These next two search limits are completely tunable. On one net -* MAX_NUMBER_OF_RESOURCES_TO_ENUM had to be 2200 to see 3 or 4 sharable disk +* MAX_NUMBER_OF_RESOURCES_TO_ENUM had to be large to see 3 or 4 sharable disk * resources. This could vary widely depending on the number of servers on * the net that have no shares up * \****************************************************************************/ #define MAX_NUMBER_OF_DISK_RESOURCES_TO_LIST 3 -#define MAX_NUMBER_OF_RESOURCES_TO_ENUM 2200 +#define MAX_NUMBER_OF_RESOURCES_TO_ENUM 480000 #define LOCAL_DEVICE_NAME "W:" #define WHICH_TO_USE_FROM_LIST 0 @@ -276,8 +279,8 @@ HANDLE OpenEnum(LPNETRESOURCE lpNetConta UINT EnumResources(HANDLE hNetEnum) { - #define RESOURCE_BUF_ENTRIES 500 - NETRESOURCE ResourceBuffer[RESOURCE_BUF_ENTRIES]; // about 13K for 500 + #define RESOURCE_BUF_ENTRIES 5000 + NETRESOURCE ResourceBuffer[RESOURCE_BUF_ENTRIES]; DWORD dwSzResourceBuf; DWORD dwEntriesToGet; @@ -396,17 +399,17 @@ UINT EnumResources(HANDLE hNetEnum) * servers make sense to filter out in your environment * * The first clause shows how to include in the filter the top - * level NT Lan Man container, the second clause shows how to - * include in the filter a domain name, and the third and fourth - * clauses show how to include any servers whose names start with - * particular characters + * level Windows NT network provider container, the second clause + * shows how to include in the filter a domain name, and the + * third and fourth clauses show how to include any servers whose + * names start with particular characters * \****************************************************************/ - if (!( (0==strncmp("NT Lan Man",ResourceBuffer[i].lpRemoteName,10)) - ||(0==strncmp("NtW000",ResourceBuffer[i].lpRemoteName,6)) - ||(0==strncmp("\\\\BR",ResourceBuffer[i].lpRemoteName,4)) - ||(0==strncmp("\\\\BL",ResourceBuffer[i].lpRemoteName,4)))) + if (!( (0==_strnicmp("Microsoft Windows Network",ResourceBuffer[i].lpRemoteName,25)) + ||(0==_strnicmp("DMAIN1",ResourceBuffer[i].lpRemoteName,6)) + ||(0==_strnicmp("\\\\BLUMPR2",ResourceBuffer[i].lpRemoteName,9)) + ||(0==_strnicmp("\\\\BLAMTR2",ResourceBuffer[i].lpRemoteName,9)))) break; if (dwResourcesEnumedSoFar < MAX_NUMBER_OF_RESOURCES_TO_ENUM) @@ -418,13 +421,13 @@ UINT EnumResources(HANDLE hNetEnum) break; default : - { UCHAR ucMsgBuf[1500]; + { UCHAR ucMsgBuf[1500]; - sprintf(ucMsgBuf,"WNetEnumResources bad .dwUsage value = 0x%X,\n", - ResourceBuffer[i].dwUsage); - PERR(ucMsgBuf); - return(1); - } + sprintf(ucMsgBuf,"WNetEnumResources bad .dwUsage value = 0x%X,\n", + ResourceBuffer[i].dwUsage); + PERR(ucMsgBuf); + return(1); + } } } } @@ -457,7 +460,7 @@ UINT EnumResources(HANDLE hNetEnum) VOID AddGetGetCancel(VOID) { UCHAR ucLocalName[sizeof(LOCAL_DEVICE_NAME)+1] = LOCAL_DEVICE_NAME; - UCHAR ucPassword[] = ""; + UCHAR ucPassword[] = "Passw00"; #define SZ_BUF 1000 UCHAR ucRemoteName[SZ_BUF]; UCHAR ucUserName [SZ_BUF]; @@ -510,7 +513,7 @@ VOID AddGetGetCancel2(VOID) { UCHAR ucLocalName[sizeof(LOCAL_DEVICE_NAME)+1] = LOCAL_DEVICE_NAME; NETRESOURCE ToConnect; - UCHAR ucPassword[] = ""; + UCHAR ucPassword[] = "Passw00"; #define SZ_BUF 1000 UCHAR ucRemoteName[SZ_BUF]; UCHAR ucUserName [SZ_BUF] = "AUserName";