Jump to content

Custom Registry Functions UDF


wraithdu
 Share

Recommended Posts

I've also found out this script is incompatible with the built-in APIRegConstants.au3.

Since it has been over 2 years, I hope it's okay to post a new update.

If anyone cares to test and confirm it, I'll eventually remove the commented out lines:

Update 1/6/14:

v2.1.0

- Commented out most of the $HKEY_.... and instead included the built-in APIRegConstants.au3

- Commented out $REG_QWORD since it's already declared in an included script (the built-in constants.au3)

_RegFunc.au3

Edited by LWC
Link to comment
Share on other sites

  • 2 years later...

I still use this UDF a lot. I did find an issue.. not with the script per say. 

Anyways I thought I would share in case anyone is using this.

a registry value was returning 0 when there was data. Apparently the registry key was created incorrectly (it was not null-terminated)

The DllCall from line 83 was returning an odd number in ret[6]

this was causing DllStructCreate in line 122 to fail, so the data return was 0.

To fix this I added under line 93:

If Mod($iLen, 2) = 1 Then  $iLen += 1 

This allow the DllStructCreate to run and the data was return correctly.

Link to comment
Share on other sites

  • 1 year later...

Sorry for late posting, but I can't quite tell what this UDF is supposed to do or help with.  I was hoping it would universalize registry reads, enums, writes, and deletes such that I wouldn't have to worry about 32-bit vs 64-bit registry entries, but it didn't appear to do that.

Is the UDF supposed to do that and I'm using it wrong? If not, what does it help with?  I read through the code to the best of my ability and, although it does check for 32 vs 64-bit OS on occasion, I couldn't figure out what it does with that, or what its benefits might be in general.

 

Link to comment
Share on other sites

On 4/16/2018 at 6:09 PM, Mbee said:

Sorry for late posting, but I can't quite tell what this UDF is supposed to do or help with.  I was hoping it would universalize registry reads, enums, writes, and deletes such that I wouldn't have to worry about 32-bit vs 64-bit registry entries, but it didn't appear to do that.

Is the UDF supposed to do that and I'm using it wrong? If not, what does it help with?  I read through the code to the best of my ability and, although it does check for 32 vs 64-bit OS on occasion, I couldn't figure out what it does with that, or what its benefits might be in general.

 

Nevermind, I'm developing a universalized UDF for 32/64-bit registry access that works correctly, but I want to ensure there are no bugs and otherwise clean up the code before posting it...  If anyone wants to know more, either respond here or PM me...

 

Link to comment
Share on other sites

You got it, argumentum!

I've already got everything working, which means that one can call any one of my four UReg functions (matching the four built-in functions) without knowing if it's a 32 or 64-bit type of key in advance.  But I've got more thinking to do about efficiency with regard to  ByRef variables (which the style guide discourages).

I've some other things to complete, too, but I expect that everything will be ready by the end of this week or early next week.

Thanks for expressing an interest!

Link to comment
Share on other sites

Sir @argumentum, would you be willing to beta test the pre-release version of the UDF I devised?

What I have now seems to work correctly in my testing, but --- (1): The option to perform the same operation on both the 32- and 64-bit modes hasn't been coded yet, and (2): Everyone needs others' eyes to see if I've got a bug or whatnot.

Let me know...

Link to comment
Share on other sites

3 hours ago, Mbee said:

would you be willing to beta test

Sure. I'll test it out, if you write the "test.au3". I'll run it on every OS version I have in VMware. I can not give it a hole lot of time but I can run a test here and there and if I see something that I feel is obvious, I'll tell you :) 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • 1 year later...
On 4/26/2018 at 3:37 PM, Mbee said:

Sir @argumentum, would you be willing to beta test

 

On 4/26/2018 at 7:05 PM, argumentum said:

Sure. I'll test it out, if you write the "test.au3"

 

7 hours ago, Skysnake said:

And? Whatever happened?

nothing. 2 years and nothing. can you believe that !.

But I am of my word. If a "test.au3" pops up, I'll recreate the setup I offered two years ago, and sure as heck I'll get it done, or help me god, I'll short circuit the internet. If don't stand for something, you don't stand for anything. And I am not that type of person/coder/MamaCalledMeFool/GoodLuckJustifyingMyExistence !  :drinks:

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • 1 month later...

I am so damn sorry! Seriously - no sarcasm. I had finished alpha coding shortly after I posted my request, but my logic was too complex for me to follow with sufficient care to believe I could actually do what I claimed to be able to do. I'm an old man whose intellect certainly isn't anywhere what it once was, and I was too anxious about getting mocked -- however gently -- for submitting crap to submit my code.

But I really do feel awful for not letting you know what was going on. And I also apologize for not checking in at the forum until now to see your notification.

Anyway, I've now attached what I have. Of course you can take all the time you wish to examine it.

Thanks

UniversalRegAccessUDF_v0.3a.zip

Link to comment
Share on other sites

On 4/26/2018 at 7:05 PM, argumentum said:

Sure. I'll test it out, if you write the "test.au3". I'll run it on every OS version I have in VMware. I can not give it a hole lot of time but I can run a test here and there and if I see something that I feel is obvious, I'll tell you :) 

Got the UDF. Nice looking code. Looking back, it makes my coding look ugly :P
Still no test.au3 in the package but by now, you know the code is good. No need for testing.
As far as getting ... "diminishing wording" from users in the forum, I personally prefer peer reviewing over keeping to my self. I find sharing enlightening, either for me or for the next one looking at the same circumstance. Therefore is better to share than not. I recently rewrote code I submitted as a ticket, because I myself, could not make sense of what I've posted. And that is just one example of my "limitations". I too am getting older. We all are. So what. The one thing I've learned is to be kind, even to the unkind. :)

In any case, what I posted above was all in good fun. And am glad you shared the code.

Cheers
 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

Thank you enormously, @argumentum, for the kind words! You have no idea how long it's been since I've received such a thoughtful and positive assessment of something I've created. You've not only made my day, you've made my month! 😊

As for your fondness for sharing and suggestion that I should consider doing likewise, I'll push myself to engage more. It's almost always pleasurable. In fact, I'm going to post a new UDF within a few days that is, my own opinion, vastly more rational than the remarkably weird "_PathSplit()" function. I stopped using the built-in function a very, very long time ago and replaced with the UDF in question because I just couldn't stand the illogical returns from PathSplit().

But every once in a while, some unusual path string would result in something unexpected, so I knew it wasn't quite there yet. By pure coincidence, I finally tracked down and squashed that that bug flat this very night!

Here are some examples of how it's different...

I don't bother returning an array, which I always thought was kinda silly, since you always just end up assigning a var like $sFileName to the appropriate array element, so I cut out the middleman and returned the various split path elements as ByRef variables.

And totally unlike the built-in function, when you call mine you never need to do any further string wrangling, for example ensuring that the drive string ALWAYS has a colon and backslash. And that the end of the folder name NEVER has a terminating backslash, so you don't have to test for that.

After the call, you can always simply concatenate the returned elements and produce a syntactically valid path. i.e....

$sFolderPath = $sDrive & $sFolderName

$sFilename = $sFilename & $sExtensionWithDot

You could NEVER count on that using the built-in function.

A special feature is the ability to specify that you want my function to try to disambiguate ambiguous paths. For example, the string 'Howdy' is a syntactically valid path, but what does it represent? It could be a folder name, or a file name without an extension, or something else. If you tell me to, I'll try to determine which was meant.

Anyway, I just want to go through and ensure that the documentation is correct and comprehensible. Once that's done, I'll post it.
 

Finally, I'm afraid that I'm not at all sure at all that my General Registry UDF doesn't need more testing. In fact, I'm sure it does. If you want to create a test script and munch though a bunch of different operations with different key lengths, I would be greatly in your debt. If not, I'll see what I can put together...

Good night and thanks again, gracious sir!

 

 

Edited by Mbee
Link to comment
Share on other sites

Forum Statistics: Total Topics: 178,048 , Total Posts: 1,362,146 ( at the time of this writing ). That is a whole lot of entries. We need to get organized or it'd be chaos.

When sharing code, a working example is expected. When an UDF, then showcase as much as is practical to show in examples.
Then there is the function header/help, describing the function, error returns, the coder's name, etc. . I personally like to include a link to the post where the code is at, for future reference ( maybe an error is found, or a better idea came up, etc. ).

As far registry, I don't use it. I write an INI file, a la Win 3.1 :D
That way I can not brake it, nor have to rely on it. Just make my folder structure  ( @AppDataCommonDir or, @AppDataDir \MyStuff\ThisOne\ThisOne.ini ).
So I'm not sufficiently experienced to write a test.au3 to find flaws. But I can load virtual PCs and let the test.au3 run on any number of conditions ( AutoIt versions, OS versions, what not )

For versioning, most will use v. 0.0.0.1 but that say nothing to me when I read it.
I use 0., for beta or good luck using this, or 1. for production. So my versioning is like 0.YYYY.MM.DD, and that makes sense to me.

_PathSplit(), ...hmmm ...I chop my own. Your idea of ByRef sounds good too. Maybe post it in "autoit-snippets" ;) 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

4 hours ago, argumentum said:

We need to get organized or it'd be chaos.

UDFs get organized in the wiki (>340 UDFs listed at the moment).
Drop me a note and I will add whatever seems sensible. Means: Code code snippets belong to the code-snippet thead as suggested by argumentum. Full fledged UDFs go to the wiki.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...