MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2CheckVolumeRegistryProperty

Function Ext2CheckVolumeRegistryProperty

Ext2Mgr/enumDisk.cpp:2402–2461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2400}
2401
2402BOOL
2403Ext2CheckVolumeRegistryProperty(PEXT2_VOLUME_PROPERTY3 EVP)
2404{
2405 CHAR UUID[50];
2406 HKEY hKey;
2407 CHAR keyPath[MAX_PATH];
2408 CHAR content[MAX_PATH];
2409 LONG status, type = 0;
2410
2411 int i;
2412 int len = 0;
2413 BOOL rc = TRUE;
2414
2415 if (Ext2IsNullUuid(&EVP->UUID[0])) {
2416 return TRUE;
2417 }
2418
2419 memset(UUID, 0, 50);
2420 for (i=0; i < 16; i++) {
2421 if (i == 0) {
2422 sprintf(&UUID[len], "{%2.2X", EVP->UUID[i]);
2423 len += 3;
2424 } else if (i == 15) {
2425 sprintf(&UUID[len], "-%2.2X}", EVP->UUID[i]);
2426 len +=4;
2427 } else {
2428 sprintf(&UUID[len], "-%2.2X", EVP->UUID[i]);
2429 len += 3;
2430 }
2431 }
2432
2433 /* Create or open ext2fsd volumes key */
2434 strcpy (keyPath, "SYSTEM\\CurrentControlSet\\Services\\Ext2Fsd\\Volumes") ;
2435 status = ::RegOpenKeyEx (HKEY_LOCAL_MACHINE,
2436 keyPath,
2437 0,
2438 KEY_ALL_ACCESS,
2439 &hKey) ;
2440 if (status != ERROR_SUCCESS) {
2441 rc = FALSE;
2442 goto errorout;
2443 }
2444
2445 /* Query volume parameters */
2446 len = MAX_PATH;
2447 status = RegQueryValueEx(hKey,
2448 &UUID[0],
2449 0,
2450 (LPDWORD)&type,
2451 (BYTE *)&content[0],
2452 (LPDWORD)&len);
2453 if (status != ERROR_SUCCESS) {
2454 rc = FALSE;
2455 }
2456
2457 RegCloseKey(hKey);
2458
2459errorout:

Callers 2

Ext2MountingVolumesFunction · 0.85
AddMountPointMethod · 0.85

Calls 1

Ext2IsNullUuidFunction · 0.70

Tested by

no test coverage detected