locked
StringFromGUID2 convert the GUID issue RRS feed

  • Question

  •    

    Hello!

    I want to decode the following GUI: {B8F9593C-8BB3-4F25-AB6B-FDFE299CEBAD}. I want to get this data to make a comparison.

       QUuid testUuid("{B8F9593C-8BB3-4F25-AB6B-FDFE299CEBAD}");
       GUID testGUID = testUuid.operator _GUID();
       LPOLESTR dataStr = new OLECHAR[MAX_PATH];
       DWORD res = StringFromGUID2(testGUID, dataStr, MAX_PATH);
    
       if (res != NULL) {
           qDebug() << std::wstring(dataStr).c_str();
           qDebug() << QString::fromWCharArray(dataStr);
           qDebug() << QString::fromStdWString(dataStr);
           qDebug() << "StringFromGUID2 succeeded";  
       } else {
           qDebug() << "StringFromGUID2 failed: " << res;
       }


    It returns:

    0x12e9a98
    "{B8F9593C-8BB3-4F25-AB6B-FDFE299CEBAD}"
    "{B8F9593C-8BB3-4F25-AB6B-FDFE299CEBAD}"

    StringFromGUID2 succeeded

    I got this GUID from the registry path: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WlanSvc\Profiles\{B8F9593C-8BB3-4F25-AB6B-FDFE299CEBAD}

    It is created when connecting to the Enterprise wireless network. The reason to decode it: when I export the wlan profile, delete it and import it to the program, then it fails to connect using the imported profile because the user credentials are missing. So, I want to add checks for this issue and for example to display the dialog to enter the user credentials in such case. Thanks.

    • Edited by Cobra91151 Monday, April 6, 2020 9:05 AM
    Sunday, April 5, 2020 5:00 PM

Answers

  • If that's the main issue, then you need to create a new question.  No wireless experts are going to check a thread entitled "StringFromGUID2 Convert the GUID Issue".

    Tim Roberts | Driver MVP Emeritus | Providenza &amp; Boekelheide, Inc.

    • Marked as answer by Cobra91151 Monday, April 6, 2020 7:15 PM
    Monday, April 6, 2020 7:04 PM

All replies

  • You can see the MSDN sample using it with Wlan APIs : WlanGetProfileList

    Sunday, April 5, 2020 5:14 PM
  • Hello!

    I have tried it. It only returns the string representation of the GUID not the the actual data from which it was created? Thanks.

    Sunday, April 5, 2020 6:08 PM
  • It is the purpose of StringFromGUID2 :

    "Converts a globally unique identifier (GUID) into a string of printable characters."

    I don't see what you mean as a GUID is just a structure :  GUID structure

    Sunday, April 5, 2020 6:18 PM
  • I got this GUID from the registry path: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WlanSvc\Profiles\{B8F9593C-8BB3-4F25-AB6B-FDFE299CEBAD}

    It is created when connecting to the Enterprise wireless network. The reason to decode it: when I export the wlan profile, delete it and import it to the program, then it fails to connect using the imported profile because the user credentials are missing. So, I want to add checks for this issue and for example to display the dialog to enter the user credentials in such case. Thanks.


    Sunday, April 5, 2020 6:44 PM
  • I want to detect if the user enterprise credentials are present or not in the system for the stored wireless profile. Is there any API for this? Thank you.
    Sunday, April 5, 2020 6:54 PM
  • > DWORD res = StringFromGUID2(testGUID, dataStr, sizeof(dataStr));

    dataStr is a pointer.  sizeof a pointer is always 8 in 64-bit code.  You need to pass MAX_PATH.


    Tim Roberts | Driver MVP Emeritus | Providenza &amp; Boekelheide, Inc.

    Monday, April 6, 2020 12:34 AM
  • Yes. I know, I have fixed it, but it still does not help to fix the main issue: I want to detect if the user enterprise credentials are present or not in the system for the stored wireless profile. Is there any API for this? Thank you.
    Monday, April 6, 2020 9:04 AM
  • If that's the main issue, then you need to create a new question.  No wireless experts are going to check a thread entitled "StringFromGUID2 Convert the GUID Issue".

    Tim Roberts | Driver MVP Emeritus | Providenza &amp; Boekelheide, Inc.

    • Marked as answer by Cobra91151 Monday, April 6, 2020 7:15 PM
    Monday, April 6, 2020 7:04 PM