aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/basetypes/MCStringWin32.cpp
blob: 8ef891d181df830f0067b182c6593244723819a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "MCWin32.h" // Should be included first.

#include "MCString.h"

using namespace mailcore;

#define UUID_STR_LEN 36

String * String::uuidString()
{
    GUID uuid;
    CoCreateGuid(&uuid);
    OLECHAR szGUID[39] = { 0 };
    char uuidString[37] = { 0 };
    StringFromGUID2(uuid, (LPOLESTR)szGUID, 39); // per documentation.
    for(int i = 0; i < UUID_STR_LEN; i++) {
        uuidString[i] = tolower(szGUID[i]);
    }
    return String::stringWithUTF8Characters(uuidString);
}