ReactOS  0.4.14-dev-337-gf981a68
PathResolve.cpp File Reference
#include "shelltest.h"
#include <assert.h>
Include dependency graph for PathResolve.cpp:

Go to the source code of this file.

Classes

struct  ENTRY
 

Macros

#define PRF_VERIFYEXISTS   0x01
 
#define PRF_EXECUTABLE   0x02
 
#define PRF_TRYPROGRAMEXTENSIONS   (PRF_EXECUTABLE | PRF_VERIFYEXISTS)
 
#define PRF_FIRSTDIRDEF   0x04
 
#define PRF_DONTFINDLNK   0x08
 
#define PRF_REQUIREABSOLUTE   0x10
 
#define FLAGS0   0
 
#define FLAGS1   PRF_VERIFYEXISTS
 
#define FLAGS2   PRF_EXECUTABLE
 
#define FLAGS3   PRF_TRYPROGRAMEXTENSIONS
 
#define FLAGS4   (PRF_FIRSTDIRDEF | PRF_VERIFYEXISTS)
 
#define FLAGS5   (PRF_FIRSTDIRDEF | PRF_EXECUTABLE)
 
#define FLAGS6   (PRF_FIRSTDIRDEF | PRF_TRYPROGRAMEXTENSIONS)
 
#define FLAGS7   (PRF_REQUIREABSOLUTE | PRF_VERIFYEXISTS)
 
#define FLAGS8   (PRF_REQUIREABSOLUTE | PRF_EXECUTABLE)
 
#define FLAGS9   (PRF_REQUIREABSOLUTE | PRF_TRYPROGRAMEXTENSIONS)
 
#define FLAGS10   (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | PRF_VERIFYEXISTS)
 
#define FLAGS11   (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | PRF_EXECUTABLE)
 
#define FLAGS12   (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | PRF_TRYPROGRAMEXTENSIONS)
 
#define FLAGS13   0xFFFFFFFF
 
#define EF_FULLPATH   1
 
#define EF_TESTDATA   2
 
#define EF_WINDOWS_DIR   4
 
#define EF_SYSTEM_DIR   8
 
#define EF_TYPE_MASK   0xF
 
#define EF_NAME_ONLY   16
 
#define EF_APP_PATH   32
 
#define BEEF   0xBEEF /* Error Code 48879 */
 
#define DEAD   0xDEAD /* Error Code 57005 */
 
#define IGNORE_ERR   0x7F7F7F7F /* Ignore Error Code */
 
#define RAISED   9999 /* exception raised */
 

Typedefs

typedef int(WINAPIPATHRESOLVE) (LPWSTR, LPWSTR *, UINT)
 
typedef struct ENTRY ENTRY
 

Functions

static BOOL CreateShortcut (LPCWSTR pszLnkFileName, LPCWSTR pszTargetPathName)
 
static BOOL CreateRegAppPath (INT EntryNumber, const WCHAR *Name, const WCHAR *Value)
 
static BOOL DeleteRegAppPath (INT EntryNumber, const WCHAR *Name)
 
static void DoEntry (INT EntryNumber, const ENTRY *pEntry)
 
static void TestMain_PathResolve (void)
 
 START_TEST (PathResolve)
 

Variables

static HINSTANCE s_hShell32 = NULL
 
static PATHRESOLVE s_pPathResolve = NULL
 
static WCHAR s_TestDataPath [MAX_PATH]
 
static WCHAR s_LinkFilePath [MAX_PATH]
 
static WCHAR s_LinkTargetPath [MAX_PATH]
 
static LPWSTR s_Dirs [2]
 
static const ENTRY s_Entries []
 

Macro Definition Documentation

◆ BEEF

#define BEEF   0xBEEF /* Error Code 48879 */

Definition at line 75 of file PathResolve.cpp.

◆ DEAD

#define DEAD   0xDEAD /* Error Code 57005 */

Definition at line 76 of file PathResolve.cpp.

◆ EF_APP_PATH

#define EF_APP_PATH   32

Definition at line 61 of file PathResolve.cpp.

◆ EF_FULLPATH

#define EF_FULLPATH   1

Definition at line 54 of file PathResolve.cpp.

◆ EF_NAME_ONLY

#define EF_NAME_ONLY   16

Definition at line 60 of file PathResolve.cpp.

◆ EF_SYSTEM_DIR

#define EF_SYSTEM_DIR   8

Definition at line 57 of file PathResolve.cpp.

◆ EF_TESTDATA

#define EF_TESTDATA   2

Definition at line 55 of file PathResolve.cpp.

◆ EF_TYPE_MASK

#define EF_TYPE_MASK   0xF

Definition at line 58 of file PathResolve.cpp.

◆ EF_WINDOWS_DIR

#define EF_WINDOWS_DIR   4

Definition at line 56 of file PathResolve.cpp.

◆ FLAGS0

#define FLAGS0   0

Definition at line 39 of file PathResolve.cpp.

◆ FLAGS1

#define FLAGS1   PRF_VERIFYEXISTS

Definition at line 40 of file PathResolve.cpp.

◆ FLAGS10

Definition at line 49 of file PathResolve.cpp.

◆ FLAGS11

Definition at line 50 of file PathResolve.cpp.

◆ FLAGS12

Definition at line 51 of file PathResolve.cpp.

◆ FLAGS13

#define FLAGS13   0xFFFFFFFF

Definition at line 52 of file PathResolve.cpp.

◆ FLAGS2

#define FLAGS2   PRF_EXECUTABLE

Definition at line 41 of file PathResolve.cpp.

◆ FLAGS3

Definition at line 42 of file PathResolve.cpp.

◆ FLAGS4

Definition at line 43 of file PathResolve.cpp.

◆ FLAGS5

Definition at line 44 of file PathResolve.cpp.

◆ FLAGS6

Definition at line 45 of file PathResolve.cpp.

◆ FLAGS7

Definition at line 46 of file PathResolve.cpp.

◆ FLAGS8

Definition at line 47 of file PathResolve.cpp.

◆ FLAGS9

Definition at line 48 of file PathResolve.cpp.

◆ IGNORE_ERR

#define IGNORE_ERR   0x7F7F7F7F /* Ignore Error Code */

Definition at line 77 of file PathResolve.cpp.

◆ PRF_DONTFINDLNK

#define PRF_DONTFINDLNK   0x08

Definition at line 33 of file PathResolve.cpp.

◆ PRF_EXECUTABLE

#define PRF_EXECUTABLE   0x02

Definition at line 30 of file PathResolve.cpp.

◆ PRF_FIRSTDIRDEF

#define PRF_FIRSTDIRDEF   0x04

Definition at line 32 of file PathResolve.cpp.

◆ PRF_REQUIREABSOLUTE

#define PRF_REQUIREABSOLUTE   0x10

Definition at line 36 of file PathResolve.cpp.

◆ PRF_TRYPROGRAMEXTENSIONS

#define PRF_TRYPROGRAMEXTENSIONS   (PRF_EXECUTABLE | PRF_VERIFYEXISTS)

Definition at line 31 of file PathResolve.cpp.

◆ PRF_VERIFYEXISTS

#define PRF_VERIFYEXISTS   0x01

Definition at line 29 of file PathResolve.cpp.

◆ RAISED

#define RAISED   9999 /* exception raised */

Definition at line 78 of file PathResolve.cpp.

Typedef Documentation

◆ ENTRY

typedef struct ENTRY ENTRY

◆ PATHRESOLVE

typedef int(WINAPI * PATHRESOLVE) (LPWSTR, LPWSTR *, UINT)

Definition at line 18 of file PathResolve.cpp.

Function Documentation

◆ CreateRegAppPath()

static BOOL CreateRegAppPath ( INT  EntryNumber,
const WCHAR Name,
const WCHAR Value 
)
static

Definition at line 596 of file PathResolve.cpp.

597 {
598  HKEY RegistryKey;
599  LONG Result;
600  WCHAR Buffer[1024];
602 
603  wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
604  wcscat(Buffer, Name);
606  0, KEY_WRITE, NULL, &RegistryKey, &Disposition);
607  if (Result != ERROR_SUCCESS)
608  {
609  trace("#%d: Could not create test key. Status: %lu\n", EntryNumber, Result);
610  return FALSE;
611  }
612  Result = RegSetValueW(RegistryKey, NULL, REG_SZ, Value, 0);
613  if (Result != ERROR_SUCCESS)
614  {
615  trace("#%d: Could not set value of the test key. Status: %lu\n", EntryNumber, Result);
616  RegCloseKey(RegistryKey);
617  return FALSE;
618  }
619  RegCloseKey(RegistryKey);
620  return TRUE;
621 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegSetValueW(HKEY hKeyOriginal, LPCWSTR lpSubKey, DWORD dwType, LPCWSTR lpData, DWORD cbData)
Definition: reg.c:5014
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
#define KEY_WRITE
Definition: nt_native.h:1031
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by DoEntry().

◆ CreateShortcut()

static BOOL CreateShortcut ( LPCWSTR  pszLnkFileName,
LPCWSTR  pszTargetPathName 
)
static

Definition at line 565 of file PathResolve.cpp.

567 {
568  IPersistFile *ppf;
569  IShellLinkW* psl;
570  HRESULT hres;
571 
573  if (SUCCEEDED(hres))
574  {
575  hres = CoCreateInstance(CLSID_ShellLink, NULL,
576  CLSCTX_INPROC_SERVER, IID_IShellLinkW, (LPVOID*)&psl);
577  if (SUCCEEDED(hres))
578  {
579  psl->SetPath(pszTargetPathName);
580  hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
581  if (SUCCEEDED(hres))
582  {
583  hres = ppf->Save(pszLnkFileName, TRUE);
584  ppf->Release();
585  }
586  psl->Release();
587  }
588  CoUninitialize();
589  }
591 
592  return SUCCEEDED(hres);
593 }
#define TRUE
Definition: types.h:120
ULONG Release()
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
nsrefcnt Release()
#define SetLastError(x)
Definition: compat.h:417
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT SetPath([in] LPCWSTR pszFile)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
const GUID IID_IPersistFile
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ DeleteRegAppPath()

static BOOL DeleteRegAppPath ( INT  EntryNumber,
const WCHAR Name 
)
static

Definition at line 624 of file PathResolve.cpp.

625 {
626  LONG Result;
627  WCHAR Buffer[1024];
628  wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
629  wcscat(Buffer, Name);
631  if (Result != ERROR_SUCCESS)
632  {
633  trace("#%d: Could not remove the test key. Status: %lu\n", EntryNumber, Result);
634  return FALSE;
635  }
636  return TRUE;
637 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
long LONG
Definition: pedump.c:60
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by DoEntry().

◆ DoEntry()

static void DoEntry ( INT  EntryNumber,
const ENTRY pEntry 
)
static

Definition at line 639 of file PathResolve.cpp.

640 {
641  WCHAR Path[MAX_PATH], PathExpected[MAX_PATH];
642  INT Ret;
643  DWORD Error;
644 
645  if (pEntry->NameBefore == NULL)
646  {
647  assert(pEntry->NameExpected == NULL);
648  }
649 
650  switch (pEntry->EF_ & EF_TYPE_MASK)
651  {
652  case EF_FULLPATH:
653  if (pEntry->NameBefore)
654  {
655  lstrcpyW(Path, pEntry->NameBefore);
656  }
657  if (pEntry->NameExpected)
658  {
659  lstrcpyW(PathExpected, pEntry->NameExpected);
660  }
661  break;
662 
663  case EF_TESTDATA:
664  if (pEntry->EF_ & EF_NAME_ONLY)
665  {
666  lstrcpyW(Path, pEntry->NameBefore);
667  }
668  else
669  {
671  lstrcatW(Path, L"\\");
672  lstrcatW(Path, pEntry->NameBefore);
673  }
674 
675  if (pEntry->NameExpected)
676  {
677  lstrcpyW(PathExpected, s_TestDataPath);
678  lstrcatW(PathExpected, L"\\");
679  lstrcatW(PathExpected, pEntry->NameExpected);
680  }
681  break;
682 
683  case EF_WINDOWS_DIR:
684  if (pEntry->EF_ & EF_NAME_ONLY)
685  {
686  lstrcpyW(Path, pEntry->NameBefore);
687  }
688  else
689  {
691  lstrcatW(Path, L"\\");
692  lstrcatW(Path, pEntry->NameBefore);
693  }
694 
695  if (pEntry->NameExpected)
696  {
697  GetWindowsDirectoryW(PathExpected, _countof(PathExpected));
698  lstrcatW(PathExpected, L"\\");
699  lstrcatW(PathExpected, pEntry->NameExpected);
700  }
701  break;
702 
703  case EF_SYSTEM_DIR:
704  if (pEntry->EF_ & EF_NAME_ONLY)
705  {
706  lstrcpyW(Path, pEntry->NameBefore);
707  }
708  else
709  {
711  lstrcatW(Path, L"\\");
712  lstrcatW(Path, pEntry->NameBefore);
713  }
714 
715  if (pEntry->NameExpected)
716  {
717  GetSystemDirectoryW(PathExpected, _countof(PathExpected));
718  lstrcatW(PathExpected, L"\\");
719  lstrcatW(PathExpected, pEntry->NameExpected);
720  }
721  break;
722  }
723 
724  if (pEntry->EF_ & EF_APP_PATH)
725  {
726  if (!CreateRegAppPath(EntryNumber, pEntry->NameBefore, PathExpected))
727  {
728  skip("#%d: CreateRegAppPath failure\n", EntryNumber);
729  return;
730  }
731  }
732 
733  _SEH2_TRY
734  {
736  if (pEntry->NameBefore)
737  {
738  Ret = (*s_pPathResolve)(Path, pEntry->Dirs, pEntry->Flags);
739  }
740  else
741  {
742  Ret = (*s_pPathResolve)(NULL, pEntry->Dirs, pEntry->Flags);
743  }
744  Error = GetLastError();
745  }
747  {
748  Ret = RAISED;
749  Error = DEAD;
750  }
751  _SEH2_END;
752 
753  if (pEntry->EF_ & EF_APP_PATH)
754  {
755  ok(DeleteRegAppPath(EntryNumber, pEntry->NameBefore),
756  "#%d: DeleteRegAppPath failed\n", EntryNumber);
757  }
758 
759  ok(Ret == pEntry->Ret, "#%d: Ret expected %d, was %d.\n",
760  EntryNumber, pEntry->Ret, Ret);
761  if (pEntry->Error != IGNORE_ERR)
762  {
763  ok(Error == pEntry->Error, "#%d: last error expected %ld, was %ld.\n",
764  EntryNumber, pEntry->Error, Error);
765  }
766 
767  if (pEntry->NameExpected && !(pEntry->EF_ & EF_APP_PATH))
768  {
769  ok(lstrcmpW(Path, PathExpected) == 0, "#%d: Path expected %s, was %s.\n",
770  EntryNumber, wine_dbgstr_w(PathExpected), wine_dbgstr_w(Path));
771  }
772 }
LPCWSTR NameExpected
Definition: PathResolve.cpp:70
UINT EF_
Definition: PathResolve.cpp:68
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define _countof(array)
Definition: fontsub.cpp:30
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define EF_WINDOWS_DIR
Definition: PathResolve.cpp:56
#define EF_SYSTEM_DIR
Definition: PathResolve.cpp:57
#define assert(x)
Definition: debug.h:53
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int32_t INT
Definition: typedefs.h:56
LPWSTR * Dirs
Definition: PathResolve.cpp:72
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
#define EF_NAME_ONLY
Definition: PathResolve.cpp:60
_SEH2_TRY
Definition: create.c:4250
#define RAISED
Definition: PathResolve.cpp:78
#define BEEF
Definition: PathResolve.cpp:75
static WCHAR s_TestDataPath[MAX_PATH]
Definition: PathResolve.cpp:22
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define IGNORE_ERR
Definition: PathResolve.cpp:77
smooth NULL
Definition: ftsmooth.c:416
#define DEAD
Definition: PathResolve.cpp:76
#define EF_FULLPATH
Definition: PathResolve.cpp:54
LPCWSTR NameBefore
Definition: PathResolve.cpp:69
__wchar_t WCHAR
Definition: xmlstorage.h:180
INT Ret
Definition: PathResolve.cpp:66
#define MAX_PATH
Definition: compat.h:26
#define EF_APP_PATH
Definition: PathResolve.cpp:61
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL DeleteRegAppPath(INT EntryNumber, const WCHAR *Name)
BOOL Error
Definition: chkdsk.c:66
#define SetLastError(x)
Definition: compat.h:417
#define EF_TYPE_MASK
Definition: PathResolve.cpp:58
static const WCHAR L[]
Definition: oid.c:1250
_SEH2_END
Definition: create.c:4424
PRTL_UNICODE_STRING_BUFFER Path
#define lstrcpyW
Definition: compat.h:414
#define ok(value,...)
Definition: atltest.h:57
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2312
static BOOL CreateRegAppPath(INT EntryNumber, const WCHAR *Name, const WCHAR *Value)
#define skip(...)
Definition: atltest.h:64
#define EF_TESTDATA
Definition: PathResolve.cpp:55
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274

Referenced by TestMain_PathResolve().

◆ START_TEST()

START_TEST ( PathResolve  )

Definition at line 838 of file PathResolve.cpp.

839 {
840  LPWSTR pch;
841 
843  pch = wcsrchr(s_TestDataPath, L'\\');
844  if (pch == NULL)
845  pch = wcsrchr(s_TestDataPath, L'/');
846  if (pch == NULL)
847  {
848  skip("GetModuleFileName and/or wcsrchr are insane.\n");
849  return;
850  }
851  lstrcpyW(pch, L"\\testdata");
853  {
854  skip("testdata is not found.\n");
855  return;
856  }
857 
858  s_Dirs[0] = s_TestDataPath;
859  s_Dirs[1] = NULL;
860 
862  lstrcatW(s_LinkFilePath, L"\\");
863  lstrcatW(s_LinkFilePath, L"CmdLineUtils.lnk");
864 
867  lstrcatW(s_LinkTargetPath, L"2PRONG.txt");
868 
870  "CreateShortcut(%s, %s) failed.\n",
872 
873  s_hShell32 = LoadLibraryA("shell32");
874  if (s_hShell32 == NULL)
875  {
876  skip("Unable to load shell32.\n");
877  return;
878  }
879 
881  if (s_pPathResolve == NULL)
882  {
883  skip("Unable to get PathResolve address.\n");
884  return;
885  }
886 
888 
889  ok(DeleteFileW(s_LinkFilePath), "DeleteFileW(%s) failed\n",
891 
893  s_hShell32 = NULL;
895 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
static void TestMain_PathResolve(void)
#define _countof(array)
Definition: fontsub.cpp:30
static LPWSTR s_Dirs[2]
Definition: PathResolve.cpp:25
int(WINAPI * PATHRESOLVE)(LPWSTR, LPWSTR *, UINT)
Definition: PathResolve.cpp:18
static PATHRESOLVE s_pPathResolve
Definition: PathResolve.cpp:21
#define pch(ap)
Definition: match.c:418
static HINSTANCE s_hShell32
Definition: PathResolve.cpp:20
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static WCHAR s_LinkFilePath[MAX_PATH]
Definition: PathResolve.cpp:23
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
static WCHAR s_TestDataPath[MAX_PATH]
Definition: PathResolve.cpp:22
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
#define FreeLibrary(x)
Definition: compat.h:413
static WCHAR s_LinkTargetPath[MAX_PATH]
Definition: PathResolve.cpp:24
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
static const WCHAR L[]
Definition: oid.c:1250
static BOOL CreateShortcut(LPCWSTR pszLnkFileName, LPCWSTR pszTargetPathName)
#define lstrcpyW
Definition: compat.h:414
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define GetProcAddress(x, y)
Definition: compat.h:418
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ TestMain_PathResolve()

static void TestMain_PathResolve ( void  )
static

Definition at line 774 of file PathResolve.cpp.

775 {
776  UINT i;
777  WCHAR Saved[128], *pPathExtSaved;
778 
779  /* save PATHEXT */
780  if (GetEnvironmentVariableW(L"PATHEXT", Saved, _countof(Saved)))
781  {
782  pPathExtSaved = Saved;
783  }
784  else
785  {
786  pPathExtSaved = NULL;
787  }
788 
789  /* normal */
790  for (i = 0; i < _countof(s_Entries); ++i)
791  {
792  DoEntry(s_Entries[i].EntryNumber, &s_Entries[i]);
793  }
794 
795  /* +#1000: reset PATHEXT */
796  if (SetEnvironmentVariableW(L"PATHEXT", NULL))
797  {
798  for (i = 0; i < _countof(s_Entries); ++i)
799  {
800  DoEntry(s_Entries[i].EntryNumber + 1000, &s_Entries[i]);
801  }
802  }
803  else
804  {
805  skip("SetEnvironmentVariableW failed\n");
806  }
807 
808  /* +#2000: set PATHEXT to ".COM;.EXE;.BAT" */
809  if (SetEnvironmentVariableW(L"PATHEXT", L".COM;.EXE;.BAT"))
810  {
811  for (i = 0; i < _countof(s_Entries); ++i)
812  {
813  DoEntry(s_Entries[i].EntryNumber + 2000, &s_Entries[i]);
814  }
815  }
816  else
817  {
818  skip("SetEnvironmentVariableW failed\n");
819  }
820 
821  /* +#3000: set PATHEXT to ".TXT" */
822  if (SetEnvironmentVariableW(L"PATHEXT", L".TXT"))
823  {
824  for (i = 0; i < _countof(s_Entries); ++i)
825  {
826  DoEntry(s_Entries[i].EntryNumber + 3000, &s_Entries[i]);
827  }
828  }
829  else
830  {
831  skip("SetEnvironmentVariableW failed\n");
832  }
833 
834  /* restore PATHEXT */
835  SetEnvironmentVariableW(L"PATHEXT", pPathExtSaved);
836 }
#define _countof(array)
Definition: fontsub.cpp:30
static void DoEntry(INT EntryNumber, const ENTRY *pEntry)
static const ENTRY s_Entries[]
Definition: PathResolve.cpp:80
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW(IN LPCWSTR lpName, IN LPCWSTR lpValue)
Definition: environ.c:259
static const WCHAR L[]
Definition: oid.c:1250
unsigned int UINT
Definition: ndis.h:50
#define skip(...)
Definition: atltest.h:64
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:420

Referenced by START_TEST().

Variable Documentation

◆ s_Dirs

LPWSTR s_Dirs[2]
static

Definition at line 25 of file PathResolve.cpp.

Referenced by START_TEST().

◆ s_Entries

const ENTRY s_Entries[]
static

Definition at line 80 of file PathResolve.cpp.

Referenced by TestMain_PathResolve().

◆ s_hShell32

HINSTANCE s_hShell32 = NULL
static

Definition at line 20 of file PathResolve.cpp.

Referenced by START_TEST().

◆ s_LinkFilePath

WCHAR s_LinkFilePath[MAX_PATH]
static

Definition at line 23 of file PathResolve.cpp.

Referenced by START_TEST().

◆ s_LinkTargetPath

WCHAR s_LinkTargetPath[MAX_PATH]
static

Definition at line 24 of file PathResolve.cpp.

Referenced by START_TEST().

◆ s_pPathResolve

PATHRESOLVE s_pPathResolve = NULL
static

Definition at line 21 of file PathResolve.cpp.

Referenced by START_TEST().

◆ s_TestDataPath

WCHAR s_TestDataPath[MAX_PATH]
static

Definition at line 22 of file PathResolve.cpp.

Referenced by DoEntry(), and START_TEST().