WinRing0 icon indicating copy to clipboard operation
WinRing0 copied to clipboard

Initialize fails when 'GetModuleFileName' returns a path beginning with "\\?\"

Open Ummon opened this issue 1 year ago • 0 comments

Function: Initialize

Depending of the shell you are using, GetModuleFileName may returns a path beginning with "\?"1. For example:

\\?\C:\Users\greg\Projects\

In this case, the function IsOnNetworkDrive will return 'true' and thus DWORD Initialize() will return 'OLS_DLL_DRIVER_NOT_FOUND'.

This happens with nushell2

I wrote a quick hack (I'm not a c expert) right before wsprintf(gDriverPath, _T("%s\\%s"), dir, gDriverFileName);:

	if ((ptr = _tcsstr(dir, "\\\\?\\")) != NULL)
	{
		int l = _tcslen(dir) - 4;
		memmove(dir, dir + 4, l);
		dir[l] = '\0';
	}

Ummon avatar Apr 02 '23 21:04 Ummon