Registry programming literacy (3)

xiaoxiao2021-03-06  46

three. RegQueryValueex and RegenumValue

The above is how to write a registry, but in many cases, read the registry. Ah, let's take a look at what API, 1, 2, ... how much? Forget it, let's say two, it should be enough. Still first talk about RegQueryValueex, this time I can't see what it means. What does query mean? Don't worry, I first check the dictionary, query, query, find it, the dictionary said it is "doubt", seeming to explain. Oh, don't check it, I know that I will pick up Jinshan. Don't say nonsense, or just say the use. This function is to say the name of a data item, then go to the value, come and see the statement:

Long RegQueryValueex (

HKEY HKEY,

LPTSTR LPVALUENAME,

LPDWORD LPRESERVED,

LPDWORD LPTYPE,

LPBYTE LPDATA,

LPDWORD LPCBDATA

);

HKEY and LPVALUENAME do not say, and the first two parameters of RegSetValueex mean the same, don't understand, look at the one chapter :)

LPRESERVED: I can't stand it! It is also a useless parameter, must be NULL.

LPTYPE, LPDATA, LPCBDATA: and the three parameters of the three parameters of the back of RegSetValueex are similar, but lptype and lpcbdata have to take the address. Not much to say. I don't know how to ask me.

return value? Needless to say, or the same.

Ok, what is it? Oh, I should say that RegenumValue, this means I understand, Enum is the meaning of enumeration, that this function is all values ​​under a key. Ok, open the door, I will say how it is used.

Long regenumvalue

HKEY HKEY,

DWORD DWINDEX,

LPTSTR LPVALUENAME,

LPDWORD LPCBVALUENAME,

LPDWORD LPRESERVED,

LPDWORD LPTYPE,

LPBYTE LPDATA,

LPDWORD LPCBDATA

);

If you have made a mistake, it is so many parameters, can't stand MS. Oh, no way, or look at it.

HKEY: Do not say, homo.

DWINDEX: The index number starts from 0, 0, 1, 2 .... Always find all the values.

LPVALUENAME: After finding a value, its name is saved here. It is obviously a string.

LPCBVALUENAME: It is the length of LPVALUENAME, don't forget to take the address.

LPRESERVED: Another reserved, NULL.

LPTYPE: The Dewtype of RegSetValueex is almost, but this is to take the address, which tells you what type of this value.

LPDATA, LPCBDATA, return value: I am exhausted, don't say it, I.

It seems that it is not clear, don't blame me, I don't know how to ask me. Well, or give a study, the instance can you explain the problem (who can't remember it):

For (int i = 0; dwres == 0; i )

{

DWORD CBV = 32, CBD = 32;

Byte szdata [32];

Char szvalue [32];

DWRES = RegenumValue (HK, I, Szvalue, & CBV, NULL, NULL, SZDATA, & CBD);

... // written

}

This chapter will write here.

four. Regdeletevalue and RegdeleteKey

Too simple, too lazy, but in order to get everyone, let's talk about it:

Long RegdeleteKey (HKEY HKEY, LPCTSTSTR LPSUBKEY);

Long RegdeleteValue (HKEY HKEY, LPCTSTSTR LPVALUENAME);

It's so simple, a delete key, a delete value. Don't tell me.

postscript.

I don't know so much, look at the table, hey, 11 o'clock, hurry to sleep. The level is limited, everyone should not laugh. <^ _ ^>

Wait a minute, how many APIs I have been written: 1, 2, 3 ... 8, not a lot, improper, the master pointing.

转载请注明原文地址:https://www.9cbs.com/read-110267.html

New Post(0)