5.单击“确定”;
修改注册表有些烦,下面是控制台程序的代码:
// modifyReg.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <windows.h> #include <stdio.h> #include <Aclapi.h> //程序用于修改SAM项的权限,赋于Administrators组成员完全控制权限 int _tmain(int argc, _TCHAR* argv[]) { LPSTR SamName = "MACHINE\\SYSTEM\\CurrentControlSet\\services\\SharedAccess"; //要修改的SAM项路径 PACL pOldDacl=NULL; PACL pNewDacl=NULL; DWORD dRet; EXPLICIT_ACCESS eia; PSECURITY_DESCRIPTOR pSID=NULL; dRet = GetNamedSecurityInfo(SamName,SE_REGISTRY_KEY,DACL_SECURITY_INFORMATION,NULL,NULL,&pOldDacl,NULL,&pSID);// 获取SAM主键的DACL if(dRet=ERROR_SUCCESS) return 0; //创建一个ACE,允许Administrators组成员完全控制对象,并允许子对象继承此权限 ZeroMemory(&eia,sizeof(EXPLICIT_ACCESS)); BuildExplicitAccessWithName(&eia,"NT SERVICE\\MpsSvc",KEY_ALL_ACCESS,SET_ACCESS,SUB_CONTAINERS_AND_OBJECTS_INHERIT); // 将新的ACE加入DACL dRet = SetEntriesInAcl(1,&eia,pOldDacl,&pNewDacl); if(dRet=ERROR_SUCCESS) return 0; // 更新SAM主键的DACL dRet = SetNamedSecurityInfo(SamName,SE_REGISTRY_KEY,DACL_SECURITY_INFORMATION,NULL,NULL,pNewDacl,NULL); if(dRet=ERROR_SUCCESS) return 0; //释放DACL和SID if(pNewDacl)LocalFree(pNewDacl); if(pSID)LocalFree(pSID); return 0; }
http://www.jb51.net/os/windows/91077.html
http://blog.csdn.net/a32132100/article/details/6605419