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. UuidFromString not creating GUID correctly - Help!

UuidFromString not creating GUID correctly - Help!

Scheduled Pinned Locked Moved C / C++ / MFC
helpsharepoint
9 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.
  • P Offline
    P Offline
    Priya_Sundar
    wrote on last edited by
    #1

    In this function i am trying to disable the dchp in the adapter register key. Also i am notify the NICs driver that the settings have changed. bool CTcpIpPropertiesChangerApp::DisableDchp() { char szValue[MAX_GUID_STRING_LEN]; CString str,str2; DWORD pdw=99; CRegKey key,key2; for(int flag=1;flag<=100;flag++) { str.Format("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\%d",flag); if(key.Open(HKEY_LOCAL_MACHINE,str,KEY_READ|KEY_WRITE)==ERROR_SUCCESS) { key.QueryValue(szValue,"ServiceName",&pdw); key.Close(); str.Format("SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters\\Interfaces\\%s",szValue); key.Open(HKEY_LOCAL_MACHINE,str,KEY_WRITE); key.Open(HKEY_LOCAL_MACHINE,str,KEY_WRITE); DWORD keyy=0; ::RegSetValueEx(key.m_hKey,"EnableDHCP",0,REG_DWORD,(PBYTE) &keyy,sizeof(PDWORD)); key.Close(); HDEVINFO hDevInfo = SetupDiGetClassDev (NULL,NULL,NULL,DIGCF_ALLCLASSES); if( INVALID_HANDLE_VALUE == hDevInfo ) { AfxMessageBox("Error :SetupDiGetClassDevs()"); return FALSE; } //An SP_PROPCHANGE_PARAMS structure corresponds to a DIF_PROPERTYCHANGE installation request. SP_PROPCHANGE_PARAMS spPropChangeParams; spPropChangeParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); spPropChangeParams.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; spPropChangeParams.Scope = DICS_FLAG_GLOBAL; spPropChangeParams.StateChange = DICS_DISABLE; spPropChangeParams.HwProfile = 0; //An SP_DEVINFO_DATA structure defines a device instance that is a member of a device information set. SP_DEVINFO_DATA spDevInfoData; spDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); for (int k=0;SetupDiEnumDeviceInfo(hDevInfo,k,&spDevInfoData);k++) { unsigned char GuidString[MAX_GUID_STRING_LEN]; GuidString[MAX_GUID_STRING_LEN - 2] = _T('\0'); for(int l=0;l

    S N 2 Replies Last reply
    0
    • P Priya_Sundar

      In this function i am trying to disable the dchp in the adapter register key. Also i am notify the NICs driver that the settings have changed. bool CTcpIpPropertiesChangerApp::DisableDchp() { char szValue[MAX_GUID_STRING_LEN]; CString str,str2; DWORD pdw=99; CRegKey key,key2; for(int flag=1;flag<=100;flag++) { str.Format("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\%d",flag); if(key.Open(HKEY_LOCAL_MACHINE,str,KEY_READ|KEY_WRITE)==ERROR_SUCCESS) { key.QueryValue(szValue,"ServiceName",&pdw); key.Close(); str.Format("SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters\\Interfaces\\%s",szValue); key.Open(HKEY_LOCAL_MACHINE,str,KEY_WRITE); key.Open(HKEY_LOCAL_MACHINE,str,KEY_WRITE); DWORD keyy=0; ::RegSetValueEx(key.m_hKey,"EnableDHCP",0,REG_DWORD,(PBYTE) &keyy,sizeof(PDWORD)); key.Close(); HDEVINFO hDevInfo = SetupDiGetClassDev (NULL,NULL,NULL,DIGCF_ALLCLASSES); if( INVALID_HANDLE_VALUE == hDevInfo ) { AfxMessageBox("Error :SetupDiGetClassDevs()"); return FALSE; } //An SP_PROPCHANGE_PARAMS structure corresponds to a DIF_PROPERTYCHANGE installation request. SP_PROPCHANGE_PARAMS spPropChangeParams; spPropChangeParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); spPropChangeParams.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; spPropChangeParams.Scope = DICS_FLAG_GLOBAL; spPropChangeParams.StateChange = DICS_DISABLE; spPropChangeParams.HwProfile = 0; //An SP_DEVINFO_DATA structure defines a device instance that is a member of a device information set. SP_DEVINFO_DATA spDevInfoData; spDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); for (int k=0;SetupDiEnumDeviceInfo(hDevInfo,k,&spDevInfoData);k++) { unsigned char GuidString[MAX_GUID_STRING_LEN]; GuidString[MAX_GUID_STRING_LEN - 2] = _T('\0'); for(int l=0;l

      S Offline
      S Offline
      Sachinpatole
      wrote on last edited by
      #2

      use GUID *ret; ret = new GUID; instead of GUID ret; after that delete ret -Sachin

      P 1 Reply Last reply
      0
      • S Sachinpatole

        use GUID *ret; ret = new GUID; instead of GUID ret; after that delete ret -Sachin

        P Offline
        P Offline
        Priya_Sundar
        wrote on last edited by
        #3

        hi sachin, Thanks for replying. But that didnt work. Now the 'ret' just gets created with the default value 'CDCDCDCD-CDCD-CDCD-CDCDCDCDCDCD}' and the funtion UuidFromString() produces no effect on it. any other idea??

        Priya Sundar

        1 Reply Last reply
        0
        • P Priya_Sundar

          In this function i am trying to disable the dchp in the adapter register key. Also i am notify the NICs driver that the settings have changed. bool CTcpIpPropertiesChangerApp::DisableDchp() { char szValue[MAX_GUID_STRING_LEN]; CString str,str2; DWORD pdw=99; CRegKey key,key2; for(int flag=1;flag<=100;flag++) { str.Format("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\%d",flag); if(key.Open(HKEY_LOCAL_MACHINE,str,KEY_READ|KEY_WRITE)==ERROR_SUCCESS) { key.QueryValue(szValue,"ServiceName",&pdw); key.Close(); str.Format("SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters\\Interfaces\\%s",szValue); key.Open(HKEY_LOCAL_MACHINE,str,KEY_WRITE); key.Open(HKEY_LOCAL_MACHINE,str,KEY_WRITE); DWORD keyy=0; ::RegSetValueEx(key.m_hKey,"EnableDHCP",0,REG_DWORD,(PBYTE) &keyy,sizeof(PDWORD)); key.Close(); HDEVINFO hDevInfo = SetupDiGetClassDev (NULL,NULL,NULL,DIGCF_ALLCLASSES); if( INVALID_HANDLE_VALUE == hDevInfo ) { AfxMessageBox("Error :SetupDiGetClassDevs()"); return FALSE; } //An SP_PROPCHANGE_PARAMS structure corresponds to a DIF_PROPERTYCHANGE installation request. SP_PROPCHANGE_PARAMS spPropChangeParams; spPropChangeParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); spPropChangeParams.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; spPropChangeParams.Scope = DICS_FLAG_GLOBAL; spPropChangeParams.StateChange = DICS_DISABLE; spPropChangeParams.HwProfile = 0; //An SP_DEVINFO_DATA structure defines a device instance that is a member of a device information set. SP_DEVINFO_DATA spDevInfoData; spDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); for (int k=0;SetupDiEnumDeviceInfo(hDevInfo,k,&spDevInfoData);k++) { unsigned char GuidString[MAX_GUID_STRING_LEN]; GuidString[MAX_GUID_STRING_LEN - 2] = _T('\0'); for(int l=0;l

          N Offline
          N Offline
          Nibu babu thomas
          wrote on last edited by
          #4

          Priya_Sundar wrote:

          GUID ret; UuidFromString(&GuidString[1], &ret);

          GUID ret = { 0 }; UuidFromString(GuidString, &ret);


          Nibu thomas MVP For VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http:\\nibuthomas.wordpress.com

          P 1 Reply Last reply
          0
          • N Nibu babu thomas

            Priya_Sundar wrote:

            GUID ret; UuidFromString(&GuidString[1], &ret);

            GUID ret = { 0 }; UuidFromString(GuidString, &ret);


            Nibu thomas MVP For VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http:\\nibuthomas.wordpress.com

            P Offline
            P Offline
            Priya_Sundar
            wrote on last edited by
            #5

            Hi, That didnt work. now 'ret' is created with default val "{00000000-0000-0000-0000-000000000000}" and the function UuidFromString() causes no effect.. Thankyou for your sugesstion! Any more ideas??

            Priya Sundar

            N 1 Reply Last reply
            0
            • P Priya_Sundar

              Hi, That didnt work. now 'ret' is created with default val "{00000000-0000-0000-0000-000000000000}" and the function UuidFromString() causes no effect.. Thankyou for your sugesstion! Any more ideas??

              Priya Sundar

              N Offline
              N Offline
              Nibu babu thomas
              wrote on last edited by
              #6

              Priya_Sundar wrote:

              UuidFromString

              What does the return value from UuidFromString say. Refer MSDN for more information. Check given GUID string.


              Nibu thomas MVP For VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http:\\nibuthomas.wordpress.com

              P 1 Reply Last reply
              0
              • N Nibu babu thomas

                Priya_Sundar wrote:

                UuidFromString

                What does the return value from UuidFromString say. Refer MSDN for more information. Check given GUID string.


                Nibu thomas MVP For VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http:\\nibuthomas.wordpress.com

                P Offline
                P Offline
                Priya_Sundar
                wrote on last edited by
                #7

                MSDN: This is the syntax of the function UuidFromString() for the version vc++6.0 RPC_STATUS RPC_ENTRY UuidFromString ( unsigned char *StringUuid, UUID *Uuid ); New 2005 version: RPC_STATUS RPC_ENTRY UuidFromString ( unsigned char __RPC_FAR* StringUuid, UUID __RPC_FAR* Uuid ); I am using vc++6.0 with PSDK and i guess __RPC_FAR wont be the cause of the problem. Further, i have modified it as, unsigned char *GuidString; GuidString = (unsigned char *)szValue; //szValue being declared as "char szValue[MAX_GUID_STRING_LEN];" and having a val "{A89377EA-D4ED-4A03-A37F-4A9DE785E1A9}" GUID ret = { 0 }; UuidFromString(GuidString,&ret); now UuidFromString returns RPC_S_INVALID_STRING_UUID stating that the string UUID is invalid.

                Priya Sundar

                N 1 Reply Last reply
                0
                • P Priya_Sundar

                  MSDN: This is the syntax of the function UuidFromString() for the version vc++6.0 RPC_STATUS RPC_ENTRY UuidFromString ( unsigned char *StringUuid, UUID *Uuid ); New 2005 version: RPC_STATUS RPC_ENTRY UuidFromString ( unsigned char __RPC_FAR* StringUuid, UUID __RPC_FAR* Uuid ); I am using vc++6.0 with PSDK and i guess __RPC_FAR wont be the cause of the problem. Further, i have modified it as, unsigned char *GuidString; GuidString = (unsigned char *)szValue; //szValue being declared as "char szValue[MAX_GUID_STRING_LEN];" and having a val "{A89377EA-D4ED-4A03-A37F-4A9DE785E1A9}" GUID ret = { 0 }; UuidFromString(GuidString,&ret); now UuidFromString returns RPC_S_INVALID_STRING_UUID stating that the string UUID is invalid.

                  Priya Sundar

                  N Offline
                  N Offline
                  Nibu babu thomas
                  wrote on last edited by
                  #8

                  Priya_Sundar wrote:

                  and having a val "{A89377EA-D4ED-4A03-A37F-4A9DE785E1A9}"

                  Try removing "{...}" from the beginning and from the end of the string.


                  Nibu thomas MVP For VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http:\\nibuthomas.wordpress.com

                  P 1 Reply Last reply
                  0
                  • N Nibu babu thomas

                    Priya_Sundar wrote:

                    and having a val "{A89377EA-D4ED-4A03-A37F-4A9DE785E1A9}"

                    Try removing "{...}" from the beginning and from the end of the string.


                    Nibu thomas MVP For VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http:\\nibuthomas.wordpress.com

                    P Offline
                    P Offline
                    Priya_Sundar
                    wrote on last edited by
                    #9

                    Hai Nibu, wowwww!!!!! Thanks a lotttttttttttttttttttttt!! It solved it. Have a nice day. :):rose:

                    Priya Sundar

                    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