#include
#include
#pragma comment (lib,"advapi32.lib")
void main()
// 建立乙個ace,允許everyone完全控制物件,並允許子物件繼承此許可權
zeromemory(&ea, sizeof(explicit_access));
buildexplicitaccesswithname(&ea, "everyone", key_all_access, set_access,
sub_containers_and_objects_inherit);
// 將新的ace加入dacl
dwret = setentriesinacl(1, &ea, polddacl, &pnewdacl);
if (dwret != error_success)
// 更新sam主鍵的dacl
dwret = setnamedsecurityinfo(samname, se_registry_key, dacl_security_information,
null, null, pnewdacl, null);
if (dwret != error_success)
// 開啟sam的子鍵
dwret = regopenkeyex(hkey_local_machine, "sam//sam//domains//account//users//000001f4",
0, key_all_access, &hkey);
if (dwret != error_success)
printf("open sam subkey successfully./n");
freeandexit:
if (hkey) regclosekey(hkey);
if (pnewdacl) localfree(pnewdacl);
// 還原sam主鍵的dacl
if (polddacl) setnamedsecurityinfo(samname, se_registry_key, dacl_security_information,
null, null, polddacl, null);
if (psd) localfree(psd);
return;
}
win32彙編使用win32 api實現字串拷貝
字串拷貝,呼叫win32的lstrcpy函式 拷貝了以後用訊息框顯示一下 386 model flat,stdcall option casemap none include s masm32 include windows.inc include s masm32 include user32.i...
用Win32 API實現序列通訊
2003 7 9 7 56 18 pcvc.wangxi 閱讀次數 30453 串列埠是常用的計算機與外部序列裝置之間的資料傳輸通道,由於序列通訊方便 易行,所以應用廣泛。我們可以利用windows api 提供的通訊函式編寫出高可移植性的 序列通訊程式。在win16中,可以利用open m clo...
win32API實現透明字幕視窗
hwnd hwnd createwindowex ws ex layered,text testwindow text 透明視窗 ws popup ws visible,0,0,20,20,null,hinstance,null setlayeredwindowattributes hwnd,0,0...