Changeset 6709 for trunk/src/shell32/shpolicy.c
- Timestamp:
- Sep 15, 2001, 11:26:26 AM (24 years ago)
- File:
-
- 1 edited
-
trunk/src/shell32/shpolicy.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/shpolicy.c
r6650 r6709 1 /* $Id: shpolicy.c,v 1.3 2001-09-05 13:47:00 bird Exp $ */2 1 /* 3 2 * shpolicy.c - Data for shell/system policies. … … 9 8 * there doesn't appear to be an updated Win98 version that 10 9 * would handle the many new policies introduced since then. 11 * You could easily write one with the information in 10 * You could easily write one with the information in 12 11 * this file... 13 * 12 * 14 13 * Up to date as of SHELL32 v4.72 (Win98, Win95 with MSIE 5) 15 14 */ … … 109 108 /* policy data array */ 110 109 111 POLICYDATA sh32_policy_table[] = 110 POLICYDATA sh32_policy_table[] = 112 111 { 113 112 { … … 456 455 457 456 /************************************************************************* 458 * SHRestricted [SHELL32.100]459 * 460 * walks through policy table, queries <app> key, <type> value, returns 457 * SHRestricted [SHELL32.100] 458 * 459 * walks through policy table, queries <app> key, <type> value, returns 461 460 * queried (DWORD) value, and caches it between called to SHInitRestricted 462 461 * to prevent unnecessary registry access. … … 465 464 * exported by ordinal 466 465 * 467 * REFERENCES: 466 * REFERENCES: 468 467 * MS System Policy Editor 469 468 * 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/ … … 472 471 DWORD WINAPI SHRestricted (DWORD pol) { 473 472 char regstr[256]; 474 HKEYxhkey;475 DWORD retval, polidx, i, datsize = 4;476 477 TRACE("(%08lx)\n",pol);478 479 polidx = -1;480 481 /* scan to see if we know this policy ID */482 for (i = 0; i < SHELL_MAX_POLICIES; i++)483 {484 if (pol == sh32_policy_table[i].polflags)485 {486 polidx = i;487 break;488 }489 }490 491 if (polidx == -1)492 {493 /* we don't know this policy, return 0 */494 TRACE("unknown policy: (%08lx)\n", pol);495 return 0;496 }497 498 /* we have a known policy */499 strcpy(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\");500 strcat(regstr, sh32_policy_table[polidx].appstr);501 502 /* first check if this policy has been cached, return it if so */503 if (sh32_policy_table[polidx].cache != SHELL_NO_POLICY)504 {505 return sh32_policy_table[polidx].cache;506 }507 508 /* return 0 and don't set the cache if any registry errors occur */509 retval = 0;510 if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)511 {512 if (RegQueryValueExA(xhkey, sh32_policy_table[polidx].keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)513 {514 sh32_policy_table[polidx].cache = retval;515 }516 517 RegCloseKey(xhkey);473 HKEY xhkey; 474 DWORD retval, polidx, i, datsize = 4; 475 476 TRACE("(%08lx)\n",pol); 477 478 polidx = -1; 479 480 /* scan to see if we know this policy ID */ 481 for (i = 0; i < SHELL_MAX_POLICIES; i++) 482 { 483 if (pol == sh32_policy_table[i].polflags) 484 { 485 polidx = i; 486 break; 487 } 488 } 489 490 if (polidx == -1) 491 { 492 /* we don't know this policy, return 0 */ 493 TRACE("unknown policy: (%08lx)\n", pol); 494 return 0; 495 } 496 497 /* we have a known policy */ 498 strcpy(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\"); 499 strcat(regstr, sh32_policy_table[polidx].appstr); 500 501 /* first check if this policy has been cached, return it if so */ 502 if (sh32_policy_table[polidx].cache != SHELL_NO_POLICY) 503 { 504 return sh32_policy_table[polidx].cache; 505 } 506 507 /* return 0 and don't set the cache if any registry errors occur */ 508 retval = 0; 509 if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS) 510 { 511 if (RegQueryValueExA(xhkey, sh32_policy_table[polidx].keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS) 512 { 513 sh32_policy_table[polidx].cache = retval; 514 } 515 516 RegCloseKey(xhkey); 518 517 } 519 518 520 return retval;519 return retval; 521 520 } 522 521 … … 559 558 { 560 559 if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies")) 561 {562 /* doesn't match, fail */563 return 0;564 }565 } 560 { 561 /* doesn't match, fail */ 562 return 0; 563 } 564 } 566 565 567 566 /* check passed, init all policy cache entries with SHELL_NO_POLICY */
Note:
See TracChangeset
for help on using the changeset viewer.
