https://bugs.winehq.org/show_bug.cgi?id=53053
Bug ID: 53053 Summary: valorant vanguard vgk.sys does not load Product: Wine Version: 7.9 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: etaash.mathamsetty@gmail.com Distribution: ---
Created attachment 72449 --> https://bugs.winehq.org/attachment.cgi?id=72449 backtrace
firstly there is an unimplemented function ntoskrnl.IoCreateFileEx After stubbing this and compiling wine it complained about a missing cng.sys copying it from the drivers folder in system32 to the system32 folder fixed this. After doing all this work it still does not work :(
https://bugs.winehq.org/show_bug.cgi?id=53053
etaash.mathamsetty@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Distribution|--- |ArchLinux
--- Comment #1 from etaash.mathamsetty@gmail.com --- ps: no dlls or drivers were copied from windows, this is builtin cng.sys that I moved
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #2 from etaash.mathamsetty@gmail.com --- another interesting this is that wine: Unhandled page fault on read access to FFFFF78000000030 at address 00000001C8E0DD90 (thread 0258), starting debugger...
the two addresses are always the same (haven't checked across reboots)
https://bugs.winehq.org/show_bug.cgi?id=53053
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|valorant vanguard vgk.sys |Riot Vanguard (Riot Games) |does not load |'vgk.sys' can't find | |'cng.sys' (copying from | |system32/drivers to | |system32 works around)
--- Comment #3 from Gijs Vermeulen gijsvrm@gmail.com --- Let's make this bug about Vanguard not finding cng.sys. That would make this a continuation of bug 48981.
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #4 from etaash.mathamsetty@gmail.com --- what about the IoCreateFileEx stub? hopefully someone can stub it, I can give a diff if needed
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #5 from Austin English austinenglish@gmail.com --- (In reply to etaash.mathamsetty from comment #4)
what about the IoCreateFileEx stub? hopefully someone can stub it, I can give a diff if needed
That's bug 51939
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #6 from etaash.mathamsetty@gmail.com --- I am trying to reserve memory at address: 0xFFFFF78000000000, with size: 0x000f0000, and the linux kernel is not letting me? Any reasons why?
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #7 from etaash.mathamsetty@gmail.com --- reserving memory here is required since vgk.sys looking for KUSER_SHARED_DATA there
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #8 from Etaash Mathamsetty etaash.mathamsetty@gmail.com --- I did some reading, and seems like I need kernel space code (probably with a driver), to get access to that reigon of memory.
https://bugs.winehq.org/show_bug.cgi?id=53053
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com
--- Comment #9 from Zeb Figura z.figura12@gmail.com --- We already handle access to the kernel-mode shared data address. You're running into bug 48988.
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #10 from Etaash Mathamsetty etaash.mathamsetty@gmail.com --- yes, I did more reading and figured that out, I need to do instruction emulation with the cmp instruction (with hex code 0x39) to get it working. I probably did something wrong since it is giving be error c000a004 (invalid windows version). I also managed to partically implement IoCreateFileEx, which I will paste below. (along with a KeAreAllApcsDisabled stub)
NTSTATUS WINAPI IoCreateFileEx( PHANDLE FileHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock, PLARGE_INTEGER AllocationSize, ULONG FileAttributes, ULONG ShareAccess, ULONG Disposition, ULONG CreateOptions, PVOID EaBuffer, ULONG EaLength, CREATE_FILE_TYPE CreateFileType, PVOID InternalParameters, ULONG Options, void* DriverContext ) { //they use these for log files, so why dont I just implement it a little FIXME(": Partially implemented\n"); SECURITY_ATTRIBUTES attr; DWORD error = 0; DWORD dispos = 0; attr.lpSecurityDescriptor = ObjectAttributes->SecurityDescriptor; attr.bInheritHandle = FALSE; attr.nLength = sizeof(attr); switch(Disposition){ case FILE_CREATE: dispos = CREATE_NEW; case FILE_SUPERSEDE: dispos = TRUNCATE_EXISTING; case FILE_OPEN_IF: dispos = OPEN_ALWAYS; case FILE_OPEN: dispos = OPEN_EXISTING; case FILE_OVERWRITE_IF: dispos = CREATE_ALWAYS; case FILE_OVERWRITE: dispos = CREATE_ALWAYS; default: break; } *FileHandle = CreateFileW(ObjectAttributes->ObjectName->Buffer, DesiredAccess, ShareAccess,&attr,dispos,FileAttributes,NULL); error = GetLastError(); if(Disposition == FILE_SUPERSEDE && error == ERROR_FILE_NOT_FOUND){ *FileHandle = CreateFileW(ObjectAttributes->ObjectName->Buffer, DesiredAccess, ShareAccess,&attr,CREATE_ALWAYS,FileAttributes,NULL); error = GetLastError(); } if(Disposition == FILE_OVERWRITE && error == 0){ *FileHandle = NULL; DeleteFileW(ObjectAttributes->ObjectName->Buffer); return STATUS_UNSUCCESSFUL; } return STATUS_SUCCESS; }
BOOLEAN WINAPI KeAreAllApcsDisabled() { FIXME(": stub: returning false\n"); return FALSE; }
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #11 from Etaash Mathamsetty etaash.mathamsetty@gmail.com --- it's probably riddled with bugs, but it works for vgk.sys
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #12 from Etaash Mathamsetty etaash.mathamsetty@gmail.com --- I switched out *FileHandle = NULL; with CloseHandle(*FileHandle); That could have caused some bad memory leaks...
https://bugs.winehq.org/show_bug.cgi?id=53053
Etaash Mathamsetty etaash.mathamsetty@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|7.9 |7.11
https://bugs.winehq.org/show_bug.cgi?id=53053
Olivier F. R. Dierick o.dierick@piezo-forte.be changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|7.11 |7.9 CC| |o.dierick@piezo-forte.be
--- Comment #13 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- Hello,
The version field should reflect the oldest wine version that is known to be affected by the issue.
It should not be changed afterwards to a newer version.
If you want to say that the issue is still present, a simple comment to state that is enough.
Regards.
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #14 from Etaash Mathamsetty etaash.mathamsetty@gmail.com --- have done some more works behind the scenes and I have this now 00d8:err:ntoskrnl:ZwLoadDriver failed to create driver L"\Registry\Machine\System\CurrentControlSet\Services\vgk": c0000365 003c:fixme:service:scmdatabase_autostart_services Auto-start service L"vgk" failed to start: 647
the driver also seems to work after I run ./wine vgk.sys, but it exits with code 101 (which probably means something is wrong) this is after implementing IoCreateFileEx, IoCreateFile (cuz I implemented Ex so why not), KeAreAllApcsDisabled, and doing some pretty sus instruction emulation with opcodes, 0x83 (cmp), 0x38 (cmp), 0x39 (cmp), and 0xa5 (mov)
I have no idea why it's return c0000365 and error 647, it's only doing this on win10 (it does get a bit farther along)
on win7 and win8, it just says invalid windows version
cmp instruction code: case 0x38: case 0x39: //cmp r/m64 r/m64 {
BYTE *data = INSTR_GetOperandAddr( context, instr + 1, prefixlen + 1, long_addr, rex, segprefix, &len ); BYTE* data2 = INSTR_GetOperandAddr(context, instr + 2, prefixlen + 2, long_addr, rex, segprefix, &len); SIZE_T offset = data - user_shared_data; SIZE_T data_size = get_op_size( long_op, rex );
if(offset <= KSHARED_USER_DATA_PAGE_SIZE - data_size) {
FIXME("data 1 = %llx data 2 = %llx\n", data, data2); //clear ZF and CF context->EFlags &= ~(1UL << 6); context->EFlags &= ~(1UL);
if( *(wine_user_shared_data + offset) == *data2) context->EFlags |= (1 << 6); else if(*(wine_user_shared_data + offset) < *data2) context->EFlags |= (1);
context->Rip += prefixlen + len + 1; return ExceptionContinueExecution; } break; } case 0x83: //cmp r/m64 imm8 { FIXME("rip: %llx\n", context->Rip); BYTE *data = INSTR_GetOperandAddr( context, instr + 1, prefixlen + 1, long_addr, rex, segprefix, &len ); //FIXME("data = %llx, data2 = %llx\n", data, data2); SIZE_T offset = data - user_shared_data; SIZE_T data_size = get_op_size( long_op, rex ); if(offset <= KSHARED_USER_DATA_PAGE_SIZE - data_size) { data = wine_user_shared_data + offset; FIXME("addr %llx offset %llx\n", data, offset); //sometimes won't finish printing due to \0 lol FIXME("data 1 = %wc instr[2] = %d\n", *(wine_user_shared_data + offset), instr[2]); //int temp = 0; context->Rip += prefixlen + len + 2;
//clear ZF and CF context->EFlags &= ~(1UL << 6); context->EFlags &= ~(1UL);
if(*(wine_user_shared_data + offset) == instr[2]) context->EFlags |= (1 << 6); else if(*(wine_user_shared_data + offset) < instr[2]) context->EFlags |= (1); return ExceptionContinueExecution; } break; }
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #15 from Etaash Mathamsetty etaash.mathamsetty@gmail.com --- by invalid windows version I mean error 317 and c000a004
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #16 from Etaash Mathamsetty etaash.mathamsetty@gmail.com --- " the driver also seems to work after I run ./wine vgk.sys, but it exits with code 101 (which probably means something is wrong)" by exit code 101, I mean that my terminal tells me it exited with code 101 (probably some unix signal)
https://bugs.winehq.org/show_bug.cgi?id=53053
--- Comment #17 from Etaash Mathamsetty etaash.mathamsetty@gmail.com --- VBoxUSB.sys also has the same issue but with USBD.SYS, which means that windows also check system32/drivers when loading dlls and this is not a one off thing
https://bugs.winehq.org/show_bug.cgi?id=53053
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch