[Bug 33502] New: SnagIt 8.x writes incomplete HKLM\\System\\CurrentControlSet\\Control\\Print\\Printers entry, causing loader failures for apps that depend on winspool.drv

wine-bugs at winehq.org wine-bugs at winehq.org
Wed May 1 13:34:28 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=33502

             Bug #: 33502
           Summary: SnagIt 8.x writes incomplete
                    HKLM\\System\\CurrentControlSet\\Control\\Print\\Print
                    ers entry, causing loader failures for apps that
                    depend on winspool.drv
           Product: Wine
           Version: 1.5.29
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: -unknown
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: focht at gmx.net
    Classification: Unclassified


Hello folks,

split off from bug 12703 

@Bruno
--- quote ---
The program still does not run. The error in console is:

err:module:attach_process_dlls "winspool.drv" failed to initialize, aborting
err:module:LdrInitializeThunk Main exe initialization for L"C:\\Program
Files\\TechSmith\\SnagIt 8\\SnagIt32.exe" failed, status c0000005

I don't know how to circumvent that.
--- quote ---

It seems the app installs it's own printer but with incomplete data.
Wine's builtin winspool.drv reads the registry data upon initialization.
Unfortunately it doesn't expect incomplete entry, crashing in dll entry point.
Nasty to debug.

This also breaks all Wine builtin apps that have "winspool.drv" dependency
("winecfg", "notepad" etc.), failing them to start.

--- snip ---
...
000d:Call PE DLL (proc=0x7dfc22d8,module=0x7dfa0000
L"winspool.drv",reason=PROCESS_ATTACH,res=0x1)
000d:Call KERNEL32.DisableThreadLibraryCalls(7dfa0000) ret=7dfc22b7
000d:Ret  KERNEL32.DisableThreadLibraryCalls() retval=00000001 ret=7dfc22b7
000d:trace:winspool:load_cups 0x7d530240: libcups.so.2 loaded
000d:Call KERNEL32.CreateMutexW(00000000,00000001,7dfc3c00
L"__WINE_WINSPOOL_MUTEX__") ret=7dfa996b
000d:Ret  KERNEL32.CreateMutexW() retval=0000007c ret=7dfa996b 
...
000d:trace:winspool:WINSPOOL_EnumPrintersW Found 1 printers
000d:Call advapi32.RegEnumKeyW(00000080,00000000,0032f6b6,000000ff)
ret=7dfb4771
000d:Ret  advapi32.RegEnumKeyW() retval=00000000 ret=7dfb4771
000d:trace:winspool:WINSPOOL_EnumPrintersW Printer 0 is L"SnagIt 8"
000d:Call advapi32.RegOpenKeyW(00000080,0032f6b6 L"SnagIt 8",0032f8b4)
ret=7dfb4861
000d:Ret  advapi32.RegOpenKeyW() retval=00000000 ret=7dfb4861
000d:Call advapi32.RegQueryValueExW(00000088,7dfc3462
L"Name",00000000,0032f604,0015c04c,0032f608) ret=7dfb2db5
000d:Ret  advapi32.RegQueryValueExW() retval=00000000 ret=7dfb2db5
000d:trace:winspool:WINSPOOL_GetStringFromReg L"Name": L"SnagIt 8"
000d:Call advapi32.RegQueryValueExW(00000088,7dfc34a8
L"Port",00000000,0032f604,0015c060,0032f608) ret=7dfb2db5
000d:Ret  advapi32.RegQueryValueExW() retval=00000002 ret=7dfb2db5
000d:warn:winspool:WINSPOOL_GetStringFromReg Got ret = 2
000d:Call advapi32.RegQueryValueExW(00000088,7dfc32c0
L"Attributes",00000000,0032f604,0032f600,0032f608) ret=7dfa5a9a
000d:Ret  advapi32.RegQueryValueExW() retval=00000002 ret=7dfa5a9a
000d:warn:winspool:get_dword_from_reg Got ret = 2 on name L"Attributes"
000d:Call advapi32.RegQueryValueExW(00000088,7dfc33d8
L"dnsTimeout",00000000,0032f604,0032f600,0032f608) ret=7dfa5a9a
000d:Ret  advapi32.RegQueryValueExW() retval=00000002 ret=7dfa5a9a
000d:warn:winspool:get_dword_from_reg Got ret = 2 on name L"dnsTimeout"
000d:Call advapi32.RegQueryValueExW(00000088,7dfc35d8
L"txTimeout",00000000,0032f604,0032f600,0032f608) ret=7dfa5a9a
000d:Ret  advapi32.RegQueryValueExW() retval=00000002 ret=7dfa5a9a
000d:warn:winspool:get_dword_from_reg Got ret = 2 on name L"txTimeout"
000d:Call advapi32.RegCloseKey(00000088) ret=7dfb4ae6
000d:Ret  advapi32.RegCloseKey() retval=00000000 ret=7dfb4ae6
000d:Call advapi32.RegCloseKey(00000080) ret=7dfb4b07
000d:Ret  advapi32.RegCloseKey() retval=00000000 ret=7dfb4b07
000d:trace:seh:raise_exception code=c0000005 flags=0 addr=0x7dfa5219
ip=7dfa5219 tid=000d
000d:trace:seh:raise_exception  info[0]=00000000
000d:trace:seh:raise_exception  info[1]=00000000
000d:trace:seh:raise_exception  eax=00000000 ebx=7dfcb154 ecx=00000005
edx=7dfc3680 esi=7ffdf000 edi=7ffd8000
000d:trace:seh:raise_exception  ebp=0032f968 esp=0032f968 cs=0023 ds=002b
es=002b fs=0063 gs=006b flags=00010202
000d:trace:seh:call_stack_handlers calling handler at 0x7bc983b2 code=c0000005
flags=0 
--- snip ---

NOTE: no "Port" value.

Source:
http://source.winehq.org/git/wine.git/blob/f63d59d640f48f5c734e09c5f0c4e322e9a6b3ee:/dlls/winspool.drv/info.c#l1544

--- snip ---
1544 static void old_printer_check( BOOL delete_phase )
1545 {
1546     PRINTER_INFO_5W* pi;
1547     DWORD needed, type, num, delete, i, size;
1548     const DWORD one = 1;
1549     HKEY key;
1550     HANDLE hprn;
1551 
1552     EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 5, NULL, 0, &needed, &num );
1553     if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return;
1554 
1555     pi = HeapAlloc( GetProcessHeap(), 0, needed );
1556     EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 5, (LPBYTE)pi, needed,
&needed, &num );
1557     for (i = 0; i < num; i++)
1558     {
1559         if (strncmpW( pi[i].pPortName, CUPS_Port, strlenW(CUPS_Port) ) &&
1560             strncmpW( pi[i].pPortName, LPR_Port, strlenW(LPR_Port) ))
1561             continue;
1562 
1563         if (open_printer_reg_key( pi[i].pPrinterName, &key )) continue;
...
--- snip ---

If the printer entry doesn't contain "Port" strncmpW() will cause a crash due
to null pointer.
Printer info members that are not present in registry are zero-initialized.

Wine should be able to cope with incomplete data.

$ du -sh SnagIt823.exe 
14M    SnagIt823.exe

$ sha1sum SnagIt823.exe 
6314a99f2378de9d072c174ea894d9697a08a546  SnagIt823.exe

$ wine --version
wine-1.5.29-38-g8e4317c

Regards

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list