Bug 49851 - JNI Registry.deleteKey and Registry.deleteValue corrupt Windows registry
Summary: JNI Registry.deleteKey and Registry.deleteValue corrupt Windows registry
Status: RESOLVED FIXED
Alias: None
Product: Tomcat Native
Classification: Unclassified
Component: Library (show other bugs)
Version: 1.1.20
Hardware: PC Windows XP
: P2 blocker (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-31 13:18 UTC by vadim.tsing
Modified: 2011-01-06 12:10 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vadim.tsing 2010-08-31 13:18:32 UTC
The issue was discovered in version 1.1.20 of Tomcat Native libraries while trying to use Registry class on Windows XP.
Unlike other methods, deleteKey() and deleteValue() do not initialize parameters that are passed to Windows APIs.
Typical initialization of string parameters consists of 

TCN_ALLOC_WSTRING(name);
...
TCN_INIT_WSTRING(name);
...
TCN_FREE_WSTRING(name);

However, the two methods listed above do not call TCN_INIT_WSTRING. Without this, the Windows API SHDeleteKeyW() is called with a null (0) parameter that causes Windows registry corruption. In my case (before issue was diagnosed) it resulted in the need to re-install Windows (twice) :-(.