Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Netserverenum function return false detail

Netserverenum function return false detail

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminjava
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 14085360
    wrote on last edited by
    #1

    Hi, I am enumerating my network and printing all server name but for mac system it is returning same OS type as windows so i am not able to differentiate machine. i am getting OS type 4099 for mac which is same for windows. also binary conversion is compatible with all predefined macro as i am doing AND with predefined macro.:java

    L 2 Replies Last reply
    0
    • U User 14085360

      Hi, I am enumerating my network and printing all server name but for mac system it is returning same OS type as windows so i am not able to differentiate machine. i am getting OS type 4099 for mac which is same for windows. also binary conversion is compatible with all predefined macro as i am doing AND with predefined macro.:java

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Does this have something to do with C/C++? If so, please show the relevant part of the code and explain what is incorrect.

      U 1 Reply Last reply
      0
      • L Lost User

        Does this have something to do with C/C++? If so, please show the relevant part of the code and explain what is incorrect.

        U Offline
        U Offline
        User 14085360
        wrote on last edited by
        #3

        it will print false details for mac and linux system. we have pre defined check for unix os type but for mac we dont have any. and the os type we are getting for mac also similar to on eof win 10 os version.

                    printf("\\tPlatform: %d\\n", pTmpBuf->sv101\_platform\_id);
                    wprintf(L"\\tName:     %s\\n", pTmpBuf->sv101\_name);
                    printf("\\tVersion:  %d.%d\\n",
                           pTmpBuf->sv101\_version\_major,
                           pTmpBuf->sv101\_version\_minor);
                    printf("\\tType:     %d", pTmpBuf->sv101\_type);
        

        Platform: 500
        Name: MACMINI-558088
        Version: 6.1
        Type: 4099

            Platform: 500
            Name:     WIN1019H2X64
            Version:  10.0
            Type:     4099
        

        where macmini is a mac system.

        V L 2 Replies Last reply
        0
        • U User 14085360

          it will print false details for mac and linux system. we have pre defined check for unix os type but for mac we dont have any. and the os type we are getting for mac also similar to on eof win 10 os version.

                      printf("\\tPlatform: %d\\n", pTmpBuf->sv101\_platform\_id);
                      wprintf(L"\\tName:     %s\\n", pTmpBuf->sv101\_name);
                      printf("\\tVersion:  %d.%d\\n",
                             pTmpBuf->sv101\_version\_major,
                             pTmpBuf->sv101\_version\_minor);
                      printf("\\tType:     %d", pTmpBuf->sv101\_type);
          

          Platform: 500
          Name: MACMINI-558088
          Version: 6.1
          Type: 4099

              Platform: 500
              Name:     WIN1019H2X64
              Version:  10.0
              Type:     4099
          

          where macmini is a mac system.

          V Offline
          V Offline
          Victor Nijegorodov
          wrote on last edited by
          #4

          Where and how do you obtain the values you are printing out?

          U 1 Reply Last reply
          0
          • V Victor Nijegorodov

            Where and how do you obtain the values you are printing out?

            U Offline
            U Offline
            User 14085360
            wrote on last edited by
            #5

            does netserverenum function retrives mac system too?

            1 Reply Last reply
            0
            • U User 14085360

              Hi, I am enumerating my network and printing all server name but for mac system it is returning same OS type as windows so i am not able to differentiate machine. i am getting OS type 4099 for mac which is same for windows. also binary conversion is compatible with all predefined macro as i am doing AND with predefined macro.:java

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Hi, First let me say that I am a Windows guy so I don't know how to troubleshoot the SAMBA or Apple SMB side of your issue. However I believe that you are looking for the SetServiceBits function[^]. This should allow you or your company (or Apple or Google or whoever wants to use this) to define:

              #define SV_TYPE_APPLE_MINI_CUSTOM_TYPE 0x123456789

              Both the client and server would need to have this type registered. All I can do is tell you what you need to do on the Windows side. Have you tried using SV_TYPE_SERVER_UNIX Looking through the Apple source code[^] I see that they have that one defined. Update: 1.) Looks like SAMBA uses[^] the 'announce as' in the configuration file to set this value. 2.) Apple code shows that they hard code this value with:

              default\_server\_announce = 0;
              default\_server\_announce |= SV\_TYPE\_WORKSTATION;
              default\_server\_announce |= SV\_TYPE\_SERVER;
              default\_server\_announce |= SV\_TYPE\_SERVER\_UNIX;
              default\_server\_announce |= SV\_TYPE\_PRINTQ\_SERVER;
              
              switch (lp\_announce\_as())
              {
              	case ANNOUNCE\_AS\_NT\_SERVER:
              	{
              		default\_server\_announce |= SV\_TYPE\_SERVER\_NT;
              		/\* fall through... \*/
              	}
              	case ANNOUNCE\_AS\_NT\_WORKSTATION:
              	{
              		default\_server\_announce |= SV\_TYPE\_NT;
              		break;
              	}
              	case ANNOUNCE\_AS\_WIN95:
              	{
              		default\_server\_announce |= SV\_TYPE\_WIN95\_PLUS;
              		break;
              	}
              	case ANNOUNCE\_AS\_WFW:
              	{
              		default\_server\_announce |= SV\_TYPE\_WFW;
              		break;
              	}
              	default:
              	{
              		break;
              	}
              }
              

              It's located at the very bottom of loadparm.c[^] So it looks like you will not be able to change this. Maybe you should t

              U 1 Reply Last reply
              0
              • U User 14085360

                it will print false details for mac and linux system. we have pre defined check for unix os type but for mac we dont have any. and the os type we are getting for mac also similar to on eof win 10 os version.

                            printf("\\tPlatform: %d\\n", pTmpBuf->sv101\_platform\_id);
                            wprintf(L"\\tName:     %s\\n", pTmpBuf->sv101\_name);
                            printf("\\tVersion:  %d.%d\\n",
                                   pTmpBuf->sv101\_version\_major,
                                   pTmpBuf->sv101\_version\_minor);
                            printf("\\tType:     %d", pTmpBuf->sv101\_type);
                

                Platform: 500
                Name: MACMINI-558088
                Version: 6.1
                Type: 4099

                    Platform: 500
                    Name:     WIN1019H2X64
                    Version:  10.0
                    Type:     4099
                

                where macmini is a mac system.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Those values must come from the systems themselves, or be set when the servers are installed on the network.

                1 Reply Last reply
                0
                • L Lost User

                  Hi, First let me say that I am a Windows guy so I don't know how to troubleshoot the SAMBA or Apple SMB side of your issue. However I believe that you are looking for the SetServiceBits function[^]. This should allow you or your company (or Apple or Google or whoever wants to use this) to define:

                  #define SV_TYPE_APPLE_MINI_CUSTOM_TYPE 0x123456789

                  Both the client and server would need to have this type registered. All I can do is tell you what you need to do on the Windows side. Have you tried using SV_TYPE_SERVER_UNIX Looking through the Apple source code[^] I see that they have that one defined. Update: 1.) Looks like SAMBA uses[^] the 'announce as' in the configuration file to set this value. 2.) Apple code shows that they hard code this value with:

                  default\_server\_announce = 0;
                  default\_server\_announce |= SV\_TYPE\_WORKSTATION;
                  default\_server\_announce |= SV\_TYPE\_SERVER;
                  default\_server\_announce |= SV\_TYPE\_SERVER\_UNIX;
                  default\_server\_announce |= SV\_TYPE\_PRINTQ\_SERVER;
                  
                  switch (lp\_announce\_as())
                  {
                  	case ANNOUNCE\_AS\_NT\_SERVER:
                  	{
                  		default\_server\_announce |= SV\_TYPE\_SERVER\_NT;
                  		/\* fall through... \*/
                  	}
                  	case ANNOUNCE\_AS\_NT\_WORKSTATION:
                  	{
                  		default\_server\_announce |= SV\_TYPE\_NT;
                  		break;
                  	}
                  	case ANNOUNCE\_AS\_WIN95:
                  	{
                  		default\_server\_announce |= SV\_TYPE\_WIN95\_PLUS;
                  		break;
                  	}
                  	case ANNOUNCE\_AS\_WFW:
                  	{
                  		default\_server\_announce |= SV\_TYPE\_WFW;
                  		break;
                  	}
                  	default:
                  	{
                  		break;
                  	}
                  }
                  

                  It's located at the very bottom of loadparm.c[^] So it looks like you will not be able to change this. Maybe you should t

                  U Offline
                  U Offline
                  User 14085360
                  wrote on last edited by
                  #8

                  I am using the NetServerEnum function to enumerate the network and printing all records. But I'm getting the same SV type for MAC OS system and Windows10 system. Also, sv101_version_major and sv101_version_minor are wrong. Kindly let me know how this function works, and from where I am getting these values. What is the limitation of this API.

                  printed logs using the provided example is:

                  NetServerEnum(pszServerName,
                  dwLevel,
                  (LPBYTE *) & pBuf,
                  dwPrefMaxLen,
                  &dwEntriesRead,
                  &dwTotalEntries,
                  dwServerType,
                  pszDomainName,
                  &dwResumeHandle);

                  //Printing logs:
                  printf("\tPlatform: %d\n", pTmpBuf->sv101_platform_id);
                  wprintf(L"\tName: %s\n", pTmpBuf->sv101_name);
                  printf("\tVersion: %d.%d\n",
                  pTmpBuf->sv101_version_major,
                  pTmpBuf->sv101_version_minor);
                  printf("\tType: %d", pTmpBuf->sv101_type);

                  Output=>

                  Platform: 500
                  Name: MACMINI-558088
                  Version: 6.1 //<==VERSION is common among both UNIX and MAC
                  Type: 4099 //<==SAME SV_TYPE
                  Platform:500
                  Name: MAILSRV
                  Version: 6.1 //<==VERSION is common among both UNIX and MAC
                  Type: 8493571
                  Platform:500
                  Name: WIN1019H2X64
                  Version: 10.0
                  Type: 4099 //<==SAME SV_TYPE

                  Where macmini is MAC and mailsrv is Unix system. sv_type of macmini and WIN1019H2X64 is the same. sv101_version_major and sv101_version_minor are the same for UNIX and MAC systems, which use SAMBA. Kindly let me know why it is? So I can differentiate these systems using predefined macros in lmserver.h.

                  L 1 Reply Last reply
                  0
                  • U User 14085360

                    I am using the NetServerEnum function to enumerate the network and printing all records. But I'm getting the same SV type for MAC OS system and Windows10 system. Also, sv101_version_major and sv101_version_minor are wrong. Kindly let me know how this function works, and from where I am getting these values. What is the limitation of this API.

                    printed logs using the provided example is:

                    NetServerEnum(pszServerName,
                    dwLevel,
                    (LPBYTE *) & pBuf,
                    dwPrefMaxLen,
                    &dwEntriesRead,
                    &dwTotalEntries,
                    dwServerType,
                    pszDomainName,
                    &dwResumeHandle);

                    //Printing logs:
                    printf("\tPlatform: %d\n", pTmpBuf->sv101_platform_id);
                    wprintf(L"\tName: %s\n", pTmpBuf->sv101_name);
                    printf("\tVersion: %d.%d\n",
                    pTmpBuf->sv101_version_major,
                    pTmpBuf->sv101_version_minor);
                    printf("\tType: %d", pTmpBuf->sv101_type);

                    Output=>

                    Platform: 500
                    Name: MACMINI-558088
                    Version: 6.1 //<==VERSION is common among both UNIX and MAC
                    Type: 4099 //<==SAME SV_TYPE
                    Platform:500
                    Name: MAILSRV
                    Version: 6.1 //<==VERSION is common among both UNIX and MAC
                    Type: 8493571
                    Platform:500
                    Name: WIN1019H2X64
                    Version: 10.0
                    Type: 4099 //<==SAME SV_TYPE

                    Where macmini is MAC and mailsrv is Unix system. sv_type of macmini and WIN1019H2X64 is the same. sv101_version_major and sv101_version_minor are the same for UNIX and MAC systems, which use SAMBA. Kindly let me know why it is? So I can differentiate these systems using predefined macros in lmserver.h.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    Member 14117853 wrote:

                    Kindly let me know how this function works, and from where I am getting these values.

                    These values are set by the other side. Meaning that MACMINI-558088 broadcasts/announces itself and sets those values itself. The Netserverenum function will simply echo/repeat what MACMINI-558088 claims to be. If your SAMBA configuration file is set to announce as "Win95" then Netserverenum will print Windows 95.

                    Member 14117853 wrote:

                    sv101_version_major and sv101_version_minor are the same for UNIX and MAC systems, which use SAMBA. Kindly let me know why it is?

                    Did you invest any time reading my last post? I already told you that you can edit the SAMBA configuration file and modify these values. smb.conf[^] Scroll down and look at

                    [announce as]
                    This specifies what type of server nmbd(8) will announce itself as, to a network neighborhood browse list. By default this is set to Windows NT. The valid options are : "NT Server" (which can also be written as "NT"), "NT Workstation", "Win95" or "WfW" meaning Windows NT Server, Windows NT Workstation, Windows 95 and Windows for Workgroups respectively. Do not change this parameter unless you have a specific need to stop Samba appearing as an NT server as this may prevent Samba servers from participating as browser servers correctly.

                    Default: announce as = NT Server

                    Example: announce as = Win95

                    [announce version]
                    This specifies the major and minor version numbers that nmbd will use when announcing itself as a server. The default is 4.9. Do not change this parameter unless you have a specific need to set a Samba server to be a downlevel server.

                    Default: announce version = 4.9

                    Example: announce version = 2.0

                    By the way... these are not C++ issues, you are basically asking for SAMBA support in the C++ forum. Best Wishes, -David Delaune

                    U 1 Reply Last reply
                    0
                    • L Lost User

                      Member 14117853 wrote:

                      Kindly let me know how this function works, and from where I am getting these values.

                      These values are set by the other side. Meaning that MACMINI-558088 broadcasts/announces itself and sets those values itself. The Netserverenum function will simply echo/repeat what MACMINI-558088 claims to be. If your SAMBA configuration file is set to announce as "Win95" then Netserverenum will print Windows 95.

                      Member 14117853 wrote:

                      sv101_version_major and sv101_version_minor are the same for UNIX and MAC systems, which use SAMBA. Kindly let me know why it is?

                      Did you invest any time reading my last post? I already told you that you can edit the SAMBA configuration file and modify these values. smb.conf[^] Scroll down and look at

                      [announce as]
                      This specifies what type of server nmbd(8) will announce itself as, to a network neighborhood browse list. By default this is set to Windows NT. The valid options are : "NT Server" (which can also be written as "NT"), "NT Workstation", "Win95" or "WfW" meaning Windows NT Server, Windows NT Workstation, Windows 95 and Windows for Workgroups respectively. Do not change this parameter unless you have a specific need to stop Samba appearing as an NT server as this may prevent Samba servers from participating as browser servers correctly.

                      Default: announce as = NT Server

                      Example: announce as = Win95

                      [announce version]
                      This specifies the major and minor version numbers that nmbd will use when announcing itself as a server. The default is 4.9. Do not change this parameter unless you have a specific need to set a Samba server to be a downlevel server.

                      Default: announce version = 4.9

                      Example: announce version = 2.0

                      By the way... these are not C++ issues, you are basically asking for SAMBA support in the C++ forum. Best Wishes, -David Delaune

                      U Offline
                      U Offline
                      User 14085360
                      wrote on last edited by
                      #10

                      Hi David, thanks for the updates.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups