登錄檔的遍歷和遞迴

2022-09-16 18:00:21 字數 747 閱讀 9129

1.遍歷。用於查詢某鍵(無子鍵)下面的所有值。以下示例了在win7下查詢所有設定了相容性的程式:

;
tchar szdata[max_path]=;
for (;;++i)
wstring str(subkey);
_tprintf_s(_t("\t#%d %s 設定相容性為:%s\n"),i,subkey,szdata);
}
if (bfindcompat == false)
regclosekey(hk);
}
return 1;
}

2.遞迴。用於遍歷包含子鍵的鍵下面的所有值。以下示例參考:

void regsearch(hkey hkey, tchar rootkey, cstring path)
/*沒有查到,則進入子鍵查詢*/
else
}
}
regclosekey(hkey);						//收尾工作是一定要做的,否則機器會異常的慢
}

遞迴遍歷登錄檔

首先描述下寫這個 的思路,我的本意是想要從windows 2000登錄檔裡獲取pc已安裝的補丁資訊,已知路徑hkey local machine software microsoft updates,但是它下面還有很多路徑,由於我只有這一台虛擬機器,所以不敢確定其他2000的pc也是這種固定路徑,所...

遍歷登錄檔

123 open register key 4if regopenkeyex hkey current user,software oki ccons33 unittype 0,key all access,oldhkey error success 527 28 print the key and...

遍歷刪除登錄檔

dword deletetree hkey rootkey,const char psubkey nret regqueryinfokey hkey,null,null,null,keycnt,keymaxlen,null,namecnt,namemaxlen,maxdatelen,null,nul...