forked from kuri65536/python-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.cpp
More file actions
36 lines (27 loc) · 842 Bytes
/
Copy pathutil.cpp
File metadata and controls
36 lines (27 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <windows.h>
#include "util.h"
namespace PyWidcomm {
int
str2uuid( const char *uuid_str, GUID *uuid)
{
// Parse uuid128 standard format: 12345678-9012-3456-7890-123456789012
int i;
char buf[20] = { 0 };
strncpy(buf, uuid_str, 8);
uuid->Data1 = strtoul( buf, NULL, 16 );
memset(buf, 0, sizeof(buf));
strncpy(buf, uuid_str+9, 4);
uuid->Data2 = (unsigned short) strtoul( buf, NULL, 16 );
memset(buf, 0, sizeof(buf));
strncpy(buf, uuid_str+14, 4);
uuid->Data3 = (unsigned short) strtoul( buf, NULL, 16 );
memset(buf, 0, sizeof(buf));
strncpy(buf, uuid_str+19, 4);
strncpy(buf+4, uuid_str+24, 12);
for( i=0; i<8; i++ ) {
char buf2[3] = { buf[2*i], buf[2*i+1], 0 };
uuid->Data4[i] = (unsigned char)strtoul( buf2, NULL, 16 );
}
return 0;
}
}