Ignore:
Timestamp:
Sep 15, 2001, 11:26:26 AM (24 years ago)
Author:
sandervl
Message:

restored old version

File:
1 edited

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 $ */
    21/*
    32 * shpolicy.c - Data for shell/system policies.
     
    98 * there doesn't appear to be an updated Win98 version that
    109 * 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 
    1211 * this file...
    13  *
     12 * 
    1413 * Up to date as of SHELL32 v4.72 (Win98, Win95 with MSIE 5)
    1514 */
     
    109108/* policy data array */
    110109
    111 POLICYDATA sh32_policy_table[] =
     110POLICYDATA sh32_policy_table[] = 
    112111{
    113112  {
     
    456455
    457456/*************************************************************************
    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 
    461460 * queried (DWORD) value, and caches it between called to SHInitRestricted
    462461 * to prevent unnecessary registry access.
     
    465464 *     exported by ordinal
    466465 *
    467  * REFERENCES:
     466 * REFERENCES: 
    468467 *     MS System Policy Editor
    469468 *     98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/
     
    472471DWORD WINAPI SHRestricted (DWORD pol) {
    473472        char regstr[256];
    474     HKEY    xhkey;
    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);
    518517}
    519518
    520     return retval;
     519        return retval;
    521520}
    522521
     
    559558     {
    560559         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     }                               
    566565
    567566     /* check passed, init all policy cache entries with SHELL_NO_POLICY */
Note: See TracChangeset for help on using the changeset viewer.