修改了一个setacl的BUG

setacl在处理注册表时有问题,写得不对。修改如下:

csetacl.cpp:

--- CSetACL.cpp.old     2009-04-06 23:44:41.000000000 +0800 +++ CSetACL.cpp 2009-04-06 23:57:16.000000000 +0800 @@ -2288,7 +2288,7 @@         m_nAPIError                     =       RegOpenKeyEx (hRemoteKey ? hRemoteKey : hMainKey,  sSubkeyPath, 0, KEY_ENUMERATE_SUB_KEYS | KEY_EXECUTE, &hOpenStd);           // We now know the key exists. Let's try some black magic and open it like a backup program -       if (hOpenStd && (m_nAPIError == ERROR_SUCCESS || m_nAPIError == ERROR_ACCESS_DENIED)) +       if (hOpenStd || m_nAPIError == ERROR_ACCESS_DENIED)         {                 DWORD   nNewCreated     =       0;                 DWORD nErrTmp   =       0; @@ -2307,6 +2307,7 @@                 if (hOpenBckp && nErrTmp == ERROR_SUCCESS)                 {                         *hSubKey                =       hOpenBckp; +                       m_nAPIError = ERROR_SUCCESS;                           // The standard key is not needed                         RegCloseKey (hOpenStd);

新exe在这里.

设置注册表权限方法:

setacl -ot reg -on HKEY_LOCAL_MACHINE\aaaa\hehe  -rec yes  -actn setowner  -ownr n:Administrators -actn clear -clr dacl -actn setprot -op dacl:np

Leave a Reply