|Summary:||JNI Registry.deleteKey and Registry.deleteValue corrupt Windows registry|
|Component:||Library||Assignee:||Tomcat Developers Mailing List <dev>|
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) :-(.