Windows Api-regenumvalue

Source: Internet
Author: User

1#include <windows.h>2#include <stdio.h>3#include <tchar.h>4 5 #defineMax_key_length 2556 #defineMax_value_name 163837 8 voidQuerykey (HKEY HKEY)9 { TenTCHAR achkey[max_key_length];//buffer for subkey name oneDWORD cbname;//size of name string aTCHAR achclass[max_path] = TEXT ("");//buffer for Class name -DWORD Cchclassname = max_path;//size of class string -DWORD csubkeys=0;//Number of subkeys theDWORD cbmaxsubkey;//Longest subkey size -DWORD cchmaxclass;//Longest class string -DWORD cValues;//Number of values for key -DWORD cchmaxvalue;//Longest Value name +DWORD cbmaxvaluedata;//Longest Value data -DWORD cbsecuritydescriptor;//size of security descriptor +FILETIME ftlastwritetime;//last Write time a   at DWORD i, retCode; -   - TCHAR achvalue[max_value_name]; -DWORD Cchvalue =max_value_name; -   -     //Get the class name and the value Count. inRetCode =RegQueryInfoKey ( -hKey,//Key Handle toachclass,//buffer for Class name +&cchclassname,//size of class string -Null//reserved the&csubkeys,//Number of subkeys *&cbmaxsubkey,//Longest subkey size $&cchmaxclass,//Longest class stringPanax Notoginseng&cvalues,//Number of values for this key -&cchmaxvalue,//Longest Value name the&cbmaxvaluedata,//Longest Value data +&cbsecuritydescriptor,//Security Descriptor a&ftlastwritetime);//last Write time the   +     //enumerate the subkeys, until RegEnumKeyEx fails. -      $     if(csubkeys) $     { -printf"\nnumber of subkeys:%d\n", csubkeys); -  the          for(i=0; i<csubkeys; i++)  -         { WuyiCBName =max_key_length; theRetCode =RegEnumKeyEx (hKey, i, - achkey, wu&cbname, - NULL, about NULL, $ NULL, -&ftlastwritetime);  -             if(retCode = =Error_success) -             { a_tprintf (TEXT ("(%d)%s\n"), i+1, achkey); +             } the         } -     }  $   the     //enumerate the key values. the  the     if(cValues) the     { -printf"\nnumber of values:%d\n", cValues); in  the          for(i=0, retcode=error_success; i<cvalues; i++)  the         {  aboutCchvalue =max_value_name; theachvalue[0] =' /';  theRetCode =regenumvalue (hKey, i, the achvalue, +&cchvalue, - NULL, the NULL,Bayi NULL, the NULL); the   -             if(retCode = =Error_success) -             {  the_tprintf (TEXT ("(%d)%s\n"), i+1, achvalue);  the             }  the         } the     } - } the  the //void __cdecl _tmain (void) the //{94 //HKEY htestkey; the // the //if (regopenkeyex (hkey_local_machine, the //TEXT ("software\\autodesk"),98 //0, about //key_read, - //&htestkey) = = Error_success101 //      )102 //   {103 //Querykey (htestkey);104 //   } the //   106 //RegCloseKey (htestkey);107 //}108 109 //int WINAPI WinMain (hinstance hinstance, hinstance hprevinstance, LPSTR lpcmdline, int Ncmdshow) { the intmain () {111 HKEY htestkey; the 113    if(regopenkeyex (hkey_local_machine, theTEXT ("Software\\autodesk"), the         0, the key_read,117&htestkey) = =error_success118       )119    { - Querykey (htestkey);121    }122    123 RegCloseKey (htestkey);124}

Windows Api-regenumvalue

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.