[Bug 46320] Multiple applications and games need support for Windows Vista+ User Shell Folder layout, specifically 'Local AppData' (Amazon Kindle for PC)

WineHQ Bugzilla wine-bugs at winehq.org
Fri Apr 24 03:58:16 CDT 2020


https://bugs.winehq.org/show_bug.cgi?id=46320

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Amazon Kindle for PC        |Multiple applications and
                   |crashes with "abnormal      |games need support for
                   |program termination"        |Windows Vista+ User Shell
                   |                            |Folder layout, specifically
                   |                            |'Local AppData' (Amazon
                   |                            |Kindle for PC)
          Component|-unknown                    |shell32
                 CC|                            |focht at gmx.net
                URL|https://www.amazon.com/kind |https://s3.amazonaws.com/ki
                   |le-dbs/fd/kcp               |ndleforpc/57030/KindleForPC
                   |                            |-installer-1.28.57030.exe

--- Comment #7 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

confirming.

--- snip ---
$ WINEDEBUG=+seh,+relay,+msi,+msvcrt wine
./KindleForPC-installer-1.28.57030.exe >>log.txt 2>&1

0035:Call KERNEL32.CreateDirectoryW(09146db0 L"\\\\?\\C:\\users\\focht\\Local
Settings\\Application Data\\Amazon",00000000) ret=6714b46b
...
0035:Ret  KERNEL32.CreateDirectoryW() retval=00000000 ret=6714b46b 
...
0035:Call KERNEL32.CreateDirectoryW(09146da8 L"\\\\?\\C:\\users\\focht\\Local
Settings\\Application Data\\Amazon\\Kindle",00000000) ret=6714b46b
...
0035:Ret  KERNEL32.CreateDirectoryW() retval=00000000 ret=6714b46b 
...
0035:Call shell32.SHGetSpecialFolderPathW(00000000,0032f73c,0000001c,00000000)
ret=67152905 
...
0035:Call advapi32.RegCreateKeyW(80000001,7dbe56a0
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell
Folders",0032e878) ret=7db89ae0 
...
0035:Call advapi32.RegQueryValueExW(000000c8,7dbe6f20 L"Local
AppData",00000000,0032e880,0032f3e8,0032e884) ret=7db89b1f 
...
0035:Call advapi32.RegCreateKeyExW(80000002,7dbe5820
L"Software\\Microsoft\\Windows
NT\\CurrentVersion\\ProfileList",00000000,00000000,00000000,000f003f,00000000,0032e010,0032e638)
ret=7db885fe 
...
0035:Call advapi32.RegQueryValueExW(000000cc,7dbe57e0
L"ProfilesDirectory",00000000,0032dfc8,0032e228,0032dfcc) ret=7db8548e 
...
0035:Call shlwapi.PathFileExistsW(0032f1e0 L"C:\\users\\focht\\Local
Settings\\Application Data") ret=7db8ce2e
0035:Call kernelbase.PathFileExistsW(0032f1e0 L"C:\\users\\focht\\Local
Settings\\Application Data") ret=7bc9f754 
...
0035:Ret  kernelbase.PathFileExistsW() retval=00000001 ret=7bc9f754
0035:Ret  shlwapi.PathFileExistsW() retval=00000001 ret=7db8ce2e
0035:Ret  shell32.SHGetSpecialFolderPathW() retval=00000001 ret=67152905
...
0035:Call
msvcp120.?in@?$codecvt at _WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W at Z(091726a0,0032f998,09172658
"C:\\users\\focht\\AppData\\Local\\Amazon\\Kindle\\crashdump",0917268c
"",0032f9a0,0032fa10,0032fc10,0032f994) ret=012eaa6d 
...
0035:Call KERNEL32.GetFileAttributesW(090561f8
L"C:\\users\\focht\\AppData\\Local\\Amazon\\Kindle\\crashdump") ret=012ef321 
...
0035:Ret  KERNEL32.GetFileAttributesW() retval=ffffffff ret=012ef321
0035:Call KERNEL32.GetLastError() ret=012eec64
0035:Ret  KERNEL32.GetLastError() retval=00000003 ret=012eec64
0035:Call KERNEL32.CreateDirectoryW(090561f8
L"C:\\users\\focht\\AppData\\Local\\Amazon\\Kindle\\crashdump",00000000)
ret=012ed334
...
0035:Ret  KERNEL32.CreateDirectoryW() retval=00000000 ret=012ed334 
...
0035:Call KERNEL32.GetLastError() ret=012ed357
0035:Ret  KERNEL32.GetLastError() retval=00000003 ret=012ed357
...
0035:Call KERNEL32.RaiseException(e06d7363,00000001,00000003,0032fb44)
ret=7da3ac65
0035:Call ntdll.memcpy(0032faa8,0032fb44,0000000c) ret=7b00dba1
0035:Ret  ntdll.memcpy() retval=0032faa8 ret=7b00dba1
0035:trace:seh:raise_exception code=e06d7363 flags=1 addr=0x7b00dbb1
ip=7b00dbb1 tid=0035
0035:trace:seh:raise_exception  info[0]=19930520
0035:trace:seh:raise_exception  info[1]=0032fbe4
0035:trace:seh:raise_exception  info[2]=03bb2960
0035:trace:seh:raise_exception  eax=0032fa94 ebx=00000003 ecx=0032fb44
edx=0032fa94 esi=00000003 edi=0032fb00
0035:trace:seh:raise_exception  ebp=0032fae8 esp=0032fa94 cs=320023 ds=ffff002b
es=002b fs=f7c60063 gs=006b flags=00000212
0035:trace:seh:call_stack_handlers calling handler at 0x16c18e8 code=e06d7363
flags=1
0035:trace:seh:call_stack_handlers handler at 0x16c18e8 returned 1
0035:trace:seh:call_stack_handlers calling handler at 0x16609b9 code=e06d7363
flags=1
0035:trace:seh:call_stack_handlers handler at 0x16609b9 returned 1
0035:trace:seh:call_stack_handlers calling handler at 0x1661282 code=e06d7363
flags=1
0035:trace:seh:call_stack_handlers handler at 0x1661282 returned 1
0035:trace:seh:call_stack_handlers calling handler at 0x169be26 code=e06d7363
flags=1
0035:trace:seh:call_stack_handlers handler at 0x169be26 returned 1
0035:trace:seh:call_stack_handlers calling handler at 0x14173cc code=e06d7363
flags=1 
...
0035:Call user32.MessageBoxIndirectW(0032d398) ret=7da4676b 
...
0035:Call winex11.drv.SetWindowText(0002007c,0880e140 L"Runtime
error!\n\nProgram: C:\\Program Files
(x86)\\Amazon\\Kindle\\Kindle.exe\nabnormal program termination\n\nPress OK to
exit the program, or Cancel to start the Wine debugger.\n") ret=7e84ebf5 
...
0035:Ret  user32.MessageBoxIndirectW() retval=00000001 ret=7da4676b
0035:trace:seh:MSVCRT_raise (22)
0035:trace:msvcrt:MSVCRT__exit (3)
...
--- snip ---

The application uses different ways to determine the 'Local Application Data'
base path. It asks the OS using win32 API and also makes hard-coded assumptions
that rely on Windows Vista+ user shell folder layout.

--- snip ---
$ grep -ral '\\AppData\\Local' .wine/drive_c
.wine/drive_c/Program Files (x86)/Amazon/Kindle/CrashReporter.exe
.wine/drive_c/Program Files (x86)/Amazon/Kindle/Kindle.exe
--- snip ---

https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc766489(v=ws.10)

--- quote ---
The 'AppData\Local' folder in Windows Vista is the same as the 'Documents and
Settings\username\Local Settings\Application Data' folder in Windows XP.
--- quote ---

--------------------------------------------------------------------
| Windows Vista Profile Location | Windows XP Profile Location     |
-------------------------------------------------------------------|
| Users\username                 | Documents and Settings\username |
| AppData\Local                  | Local Settings\Application Data |
--------------------------------------------------------------------

Windows maintains backwards compatibility by using junctions in appropriate
places. For example 'Documents and Settings' is a junction to 'c:\\users\\'.
'%USERPROFILE%/Local Settings" is a junction to 'AppData\\Local' and so on ...

Wine uses a mixture of Windows XP style layout and Vista+. Due to missing
junctions it lacks certain (sub)folder as well.

Kindle app has some code paths that recursively create the missing sub-folder
structure. It uses 'boost::filesystem::create_directories' and subsequently
'boost::filesystem::create_directory'.

Before the crash, Kindle tried to create a Vista+ style
'C:\\users\\focht\\AppData\\Local\\Amazon\\Kindle\\crashdump' path that
obviously doesn't exist. Earlier, the app code operated on Windows XP shell
user folder layout because of Wine's implementation/registry settings. The app
code makes the assumption that the directory structure already exists up to the
level before 'crashdump' directory hence only used
'boost::filesystem::create_directory' which fails if parent path elements are
not present.

'Local AppData' -> '%USERPROFILE%\Local Settings\Application Data'

Vista+ 'AppData\Local' is not present (because Wine doesn't use junctions).
There are more inconsistencies/mixups though.

With some quick hacks locally applied to fix most required things, Amazon
Kindle for PC starts successfully from the install part (and manually later).

A quick search in Bugzilla reveals there are more issues reported which are
about the same underlying problem. Will merge as needed.

$ sha1sum KindleForPC-installer-1.28.57030.exe 
158897d98df7aa53c666a62747a0843b85b18129  KindleForPC-installer-1.28.57030.exe

$ du -sh KindleForPC-installer-1.28.57030.exe 
54M    KindleForPC-installer-1.28.57030.exe

$ wine --version
wine-5.6

Regards

-- 
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