Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

need help with logic on this uninstall ....


4 replies to this topic

Adam

Adam
  • Members
  • 107 posts

Posted 27 July 2002 - 02:06

I have 5 .dlls and 3 com .exe's that must not be unregisterd if the shared ref count is above "1".



I have been looking for a while and tried some logic in the help file but have not been able to get it to work.

If anyone has some sample code that will do this i would really appreciate it.

Here is the logic i think i need(tell me if im wrong)

HKLM\software\MS\windows\Currentversion\shareddlls


<<key >>                 type                value

c:\test\test2\foo.dll    REGDB_DWORD     1
c:\test\test2\foo2.dll   REGDB_DWORD    1
c:\test\test2\foo3.dll   REGDB_DWORD    1
c:\test\test2\foo4.dll   REGDB_DWORD    1
c:\test\test2\foo5.dll   REGDB_DWORD    1


If the value of foo.dll in HKLM\software\MS\windows\Currentversion\shareddlls
\ is 1 or lower then unregister
if not, leave it be.

Basically i need it to unregister the above 5 files if the shared ref count is 1 or lower but not if its 2 or higher.

Im sooo lost.

Please help.

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 28 July 2002 - 03:50

You've kind of got the right idea Adam.  However, if these files were self-registered as a part of the file group transfer, then this will be auto. handled by the uninstall.  The reference count will be automatically decremented by one and if the new value is zero, then the user is prompted to remove a shared file.

If this is not the case, then you will need do it manually.  To do so, you should get the value from the registry, converted the resulting string value to a temp. number variable via StrToNum, and decrement it.  If the previously decremented value is zero, you should unregsitry the DLL via the command "regsvr32 <path>\<filename> /u" where 'u' does an unregistration.  If the value is not zero, then you should convert it back again via NumToStr, and write the new value back out to the registry.  That way future uninstalls will have the appropriate information.

Hope it helps.


user posted image

Adam

Adam
  • Members
  • 107 posts

Posted 29 July 2002 - 21:12

well i have to do it manually.

I cant seem to get RegDBGetKeyValueEx to retrieve anything.


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs

Name: c:\foo\foo.dll
Type: REG_Dword
Value: 2


How do i get that value ?

Everytime i try RegdbGetkeyValueEx it doesnt get any number.

Adam

Adam
  • Members
  • 107 posts

Posted 29 July 2002 - 21:30

Well this seems simple enough. It seems like alot of applications would have to do this.

Can anyone help?

If i cant get this figured out by thursday ill have to fork over $100 and call installshield.  :(

Basically i just need,

Code Sample

szkey = \\software\\microsoft\\windows\\currentverison\\shareddlls
szName= TARGETDIR + "\\foo\\foo1.dll"
nvType= REGDB_NUMBER
svValue = ?
nvSize = ?

if (RegDBGetKeyValueEx (szkey,szName,nvType,svValue,nvSize) = 1 then Unregister the .dll  in szName 

else just decrement the value of szName by 1


Anyone that can help me save a hundred dollars, i will love forever :)

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 30 July 2002 - 00:35

You forgot one vital piece of information.  If you compare the registry path and your code, you'll noticed that the reference to HKLM is missing!!!

This is because before registry call(s) you need to explicitly state what area you'll be searching.  In your case:
RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);

Besides that, in looking at your sample code, the szkey value should be in quotes.  I also normally don't include the initial \\, so you may need to get rid of those.  In addition, it's better to use ^ over + as the former automatically takes care of any extra or misses backslashes, so you should change the assignment of szname to be TARGETDIR ^ "foo\\foo1.dll".  Finally, all of the lines of your code are missing semicolons, but I'm sure that's just because this is a sample.

However, that should get you going.  If you have any additional problems, just let us know.

---

Now about that $100, I'll not a greedy person, so I'll just take half of it.  You can keep the rest.  :)
user posted image