Setting Unknown Registry Type
Keywords: regentrytype
Question:
I'm getting errors on the data type of the key value. I thought it was Binary (that's what RegEdit says). But neither RegQueryBin() nor RegQueryDWord() worked. So I'm stumped again. Below is the Reg key file:REGEDIT4 [HKEY_CURRENT_USER\Software\Corel\WordPerfect\8\Undo/Redo] "Save Undo/Redo Levels to Document"=hex(80000009):01,00,00,00 "Number of Undo/Redo Levels"=hex(80000001):0a,00Answer:
Eeek. Some unknown kind of registry type.This code will read it. What do you need to set it to?
cMainRegKey = "Software\Corel\WordPerfect\8\Undo/Redo" ; Declare common (main) registry key for further settings cRegValue = 'Save Undo/Redo Levels to Document' dll=strcat(DirWindows(1),"advapi32.dll") worksize=10000 bb=BinaryAlloc(worksize) BinaryEODSet(bb,worksize) bbsize=BinaryAlloc(4) BinaryPoke4(bbsize,0,worksize) key=RegOpenKey(@REGCURRENT,cMainRegKey) rslt=DllCall(dll,long:"RegQueryValueExA",LONG:key,LPSTR:cRegValue,LPNULL,LPNULL,lpbinary:bb,lpbinary:bbsize) RegCloseKey(key) message("Rslt",rslt) a0=BinaryPeek(bb,0) a1=BinaryPeek(bb,1) a2=BinaryPeek(bb,2) a3=BinaryPeek(bb,3) Message("Value","%a0%,%a1%,%a2%,%a3%")Question (cont'd):
Thanks for the code! Do you think WinBatch will ever support that "unknown" data type?What I have to do is turn this "feature" off in WordPerfect. So I assume that I would have to set the value to zero. I went into WordPerfect and turned it off in there, then checked what it did in RegEdit, and it looked like all zeros. So, may I impose on your help again for some assistance in how to set it too.
Answer:
cMainRegKey = "Software\Corel\WordPerfect\8\Undo/Redo" ; Declare common (main) registry key for further settings cRegValue = 'Save Undo/Redo Levels to Document' cFullKey=StrCat(cMainRegKey,"[",cRegValue,"]") cType=RegEntryType(@REGCURRENT,cFullkey) dll=strcat(DirWindows(1),"advapi32.dll") worksize=4 bb=BinaryAlloc(worksize) BinaryPoke4(bb,0,0) key=RegOpenKey(@REGCURRENT,cMainRegKey) rslt=DllCall(dll,long:"RegSetValueExA",LONG:key,LPSTR:cRegValue,LPNULL,LONG:cType,lpbinary:bb,LONG:worksize) RegCloseKey(key) message("Rslt",rslt)
Article ID: W14290Filename: Setting Unknown Registry Type.txt