libwinpr: stubbed Path API
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Sun, 23 Sep 2012 02:02:55 +0000 (22:02 -0400)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Sun, 23 Sep 2012 02:02:55 +0000 (22:02 -0400)
13 files changed:
winpr/include/winpr/environment.h [new file with mode: 0644]
winpr/include/winpr/library.h
winpr/include/winpr/path.h [new file with mode: 0644]
winpr/include/winpr/tchar.h
winpr/include/winpr/wtypes.h
winpr/libwinpr/CMakeLists.txt
winpr/libwinpr/environment/CMakeLists.txt [new file with mode: 0644]
winpr/libwinpr/environment/ModuleOptions.cmake [new file with mode: 0644]
winpr/libwinpr/environment/environment.c [new file with mode: 0644]
winpr/libwinpr/library/library.c
winpr/libwinpr/path/CMakeLists.txt [new file with mode: 0644]
winpr/libwinpr/path/ModuleOptions.cmake [new file with mode: 0644]
winpr/libwinpr/path/path.c [new file with mode: 0644]

diff --git a/winpr/include/winpr/environment.h b/winpr/include/winpr/environment.h
new file mode 100644 (file)
index 0000000..eab6a88
--- /dev/null
@@ -0,0 +1,92 @@
+/**
+ * WinPR: Windows Portable Runtime
+ * Process Environment Functions
+ *
+ * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WINPR_ENVIRONMENT_H
+#define WINPR_ENVIRONMENT_H
+
+#include <winpr/winpr.h>
+#include <winpr/wtypes.h>
+
+#ifndef _WIN32
+
+WINPR_API DWORD GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer);
+WINPR_API DWORD GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer);
+
+WINPR_API BOOL SetCurrentDirectoryA(LPCSTR lpPathName);
+WINPR_API BOOL SetCurrentDirectoryW(LPCWSTR lpPathName);
+
+WINPR_API DWORD SearchPathA(LPCSTR lpPath, LPCSTR lpFileName, LPCSTR lpExtension, DWORD nBufferLength, LPSTR lpBuffer, LPSTR* lpFilePart);
+WINPR_API DWORD SearchPathW(LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR* lpFilePart);
+
+WINPR_API HANDLE GetStdHandle(DWORD nStdHandle);
+WINPR_API BOOL SetStdHandle(DWORD nStdHandle, HANDLE hHandle);
+WINPR_API BOOL SetStdHandleEx(DWORD dwStdHandle, HANDLE hNewHandle, HANDLE* phOldHandle);
+
+WINPR_API LPSTR GetCommandLineA(VOID);
+WINPR_API LPWSTR GetCommandLineW(VOID);
+
+WINPR_API BOOL NeedCurrentDirectoryForExePathA(LPCSTR ExeName);
+WINPR_API BOOL NeedCurrentDirectoryForExePathW(LPCWSTR ExeName);
+
+WINPR_API DWORD GetEnvironmentVariableA(LPCSTR lpName, LPSTR lpBuffer, DWORD nSize);
+WINPR_API DWORD GetEnvironmentVariableW(LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize);
+
+WINPR_API BOOL SetEnvironmentVariableA(LPCSTR lpName, LPCSTR lpValue);
+WINPR_API BOOL SetEnvironmentVariableW(LPCWSTR lpName, LPCWSTR lpValue);
+
+WINPR_API LPCH GetEnvironmentStrings(VOID);
+WINPR_API LPWCH GetEnvironmentStringsW(VOID);
+
+WINPR_API BOOL SetEnvironmentStringsA(LPCH NewEnvironment);
+WINPR_API BOOL SetEnvironmentStringsW(LPWCH NewEnvironment);
+
+WINPR_API DWORD ExpandEnvironmentStringsA(LPCSTR lpSrc, LPSTR lpDst, DWORD nSize);
+WINPR_API DWORD ExpandEnvironmentStringsW(LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize);
+
+WINPR_API BOOL FreeEnvironmentStringsA(LPCH lpszEnvironmentBlock);
+WINPR_API BOOL FreeEnvironmentStringsW(LPWCH lpszEnvironmentBlock);
+
+#ifdef UNICODE
+#define GetCurrentDirectory            GetCurrentDirectoryW
+#define SetCurrentDirectory            SetCurrentDirectoryW
+#define SearchPath                     SearchPathW
+#define GetCommandLine                 GetCommandLineW
+#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathW
+#define GetEnvironmentVariable         GetEnvironmentVariableW
+#define SetEnvironmentVariable         SetEnvironmentVariableW
+#define SetEnvironmentStrings          SetEnvironmentStringsW
+#define ExpandEnvironmentStrings       ExpandEnvironmentStringsW
+#define FreeEnvironmentStrings         FreeEnvironmentStringsW
+#else
+#define GetCurrentDirectory            GetCurrentDirectoryA
+#define SetCurrentDirectory            SetCurrentDirectoryA
+#define SearchPath                     SearchPathA
+#define GetCommandLine                 GetCommandLineA
+#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathA
+#define GetEnvironmentVariable         GetEnvironmentVariableA
+#define SetEnvironmentVariable         SetEnvironmentVariableA
+#define SetEnvironmentStrings          SetEnvironmentStringsA
+#define ExpandEnvironmentStrings       ExpandEnvironmentStringsA
+#define FreeEnvironmentStrings         FreeEnvironmentStringsA
+#endif
+
+#endif
+
+#endif /* WINPR_ENVIRONMENT_H */
+
index 124086b..203bcd7 100644 (file)
 #include <winpr/winpr.h>
 #include <winpr/wtypes.h>
 
+typedef HANDLE DLL_DIRECTORY_COOKIE;
+
+#define LOAD_LIBRARY_SEARCH_APPLICATION_DIR                    0x00000200
+#define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS                       0x00001000
+#define LOAD_LIBRARY_SEARCH_SYSTEM32                           0x00000800
+#define LOAD_LIBRARY_SEARCH_USER_DIRS                          0x00000400
+
+WINPR_API DLL_DIRECTORY_COOKIE AddDllDirectory(PCWSTR NewDirectory);
+WINPR_API BOOL RemoveDllDirectory(DLL_DIRECTORY_COOKIE Cookie);
+WINPR_API BOOL SetDefaultDllDirectories(DWORD DirectoryFlags);
+
 #ifndef _WIN32
 
 WINPR_API HMODULE LoadLibraryA(LPCSTR lpLibFileName);
diff --git a/winpr/include/winpr/path.h b/winpr/include/winpr/path.h
new file mode 100644 (file)
index 0000000..edcb903
--- /dev/null
@@ -0,0 +1,140 @@
+/**
+ * WinPR: Windows Portable Runtime
+ * Path Functions
+ *
+ * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WINPR_PATH_H
+#define WINPR_PATH_H
+
+#include <winpr/winpr.h>
+#include <winpr/wtypes.h>
+
+WINPR_API HRESULT PathCchAddBackslashA(PSTR pszPath, size_t cchPath);
+WINPR_API HRESULT PathCchAddBackslashW(PWSTR pszPath, size_t cchPath);
+
+WINPR_API HRESULT PathCchRemoveBackslashA(PSTR pszPath, size_t cchPath);
+WINPR_API HRESULT PathCchRemoveBackslashW(PWSTR pszPath, size_t cchPath);
+
+WINPR_API HRESULT PathCchAddBackslashExA(PSTR pszPath, size_t cchPath, PSTR* ppszEnd, size_t* pcchRemaining);
+WINPR_API HRESULT PathCchAddBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd, size_t* pcchRemaining);
+
+WINPR_API HRESULT PathCchRemoveBackslashExA(PSTR pszPath, size_t cchPath, PSTR* ppszEnd, size_t* pcchRemaining);
+WINPR_API HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd, size_t* pcchRemaining);
+
+WINPR_API HRESULT PathCchAddExtensionA(PSTR pszPath, size_t cchPath, PCSTR pszExt);
+WINPR_API HRESULT PathCchAddExtensionW(PWSTR pszPath, size_t cchPath, PCWSTR pszExt);
+
+WINPR_API HRESULT PathCchAppendA(PSTR pszPath, size_t cchPath, PCSTR pszMore);
+WINPR_API HRESULT PathCchAppendW(PWSTR pszPath, size_t cchPath, PCWSTR pszMore);
+
+WINPR_API HRESULT PathCchAppendExA(PSTR pszPath, size_t cchPath, PCSTR pszMore, unsigned long dwFlags);
+WINPR_API HRESULT PathCchAppendExW(PWSTR pszPath, size_t cchPath, PCWSTR pszMore, unsigned long dwFlags);
+
+WINPR_API HRESULT PathCchCanonicalizeA(PSTR pszPathOut, size_t cchPathOut, PCSTR pszPathIn);
+WINPR_API HRESULT PathCchCanonicalizeW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn);
+
+WINPR_API HRESULT PathCchCanonicalizeExA(PSTR pszPathOut, size_t cchPathOut, PCSTR pszPathIn, unsigned long dwFlags);
+WINPR_API HRESULT PathCchCanonicalizeExW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn, unsigned long dwFlags);
+
+WINPR_API HRESULT PathAllocCanonicalizeA(PCSTR pszPathIn, unsigned long dwFlags, PSTR* ppszPathOut);
+WINPR_API HRESULT PathAllocCanonicalizeW(PCWSTR pszPathIn, unsigned long dwFlags, PWSTR* ppszPathOut);
+
+WINPR_API HRESULT PathCchCombineA(PSTR pszPathOut, size_t cchPathOut, PCSTR pszPathIn, PCSTR pszMore);
+WINPR_API HRESULT PathCchCombineW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn, PCWSTR pszMore);
+
+WINPR_API HRESULT PathCchCombineExA(PSTR pszPathOut, size_t cchPathOut, PCSTR pszPathIn, PCSTR pszMore, unsigned long dwFlags);
+WINPR_API HRESULT PathCchCombineExW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn, PCWSTR pszMore, unsigned long dwFlags);
+
+WINPR_API HRESULT PathAllocCombineA(PCSTR pszPathIn, PCSTR pszMore, unsigned long dwFlags, PSTR* ppszPathOut);
+WINPR_API HRESULT PathAllocCombineW(PCWSTR pszPathIn, PCWSTR pszMore, unsigned long dwFlags, PWSTR* ppszPathOut);
+
+WINPR_API HRESULT PathCchFindExtensionA(PCSTR pszPath, size_t cchPath, PCSTR* ppszExt);
+WINPR_API HRESULT PathCchFindExtensionW(PCWSTR pszPath, size_t cchPath, PCWSTR* ppszExt);
+
+WINPR_API HRESULT PathCchRenameExtensionA(PSTR pszPath, size_t cchPath, PCSTR pszExt);
+WINPR_API HRESULT PathCchRenameExtensionW(PWSTR pszPath, size_t cchPath, PCWSTR pszExt);
+
+WINPR_API HRESULT PathCchRemoveExtensionA(PSTR pszPath, size_t cchPath);
+WINPR_API HRESULT PathCchRemoveExtensionW(PWSTR pszPath, size_t cchPath);
+
+WINPR_API BOOL PathCchIsRootA(PCSTR pszPath);
+WINPR_API BOOL PathCchIsRootW(PCWSTR pszPath);
+
+WINPR_API BOOL PathIsUNCExA(PCSTR pszPath, PCSTR* ppszServer);
+WINPR_API BOOL PathIsUNCExW(PCWSTR pszPath, PCWSTR* ppszServer);
+
+WINPR_API HRESULT PathCchSkipRootA(PCSTR pszPath, PCSTR* ppszRootEnd);
+WINPR_API HRESULT PathCchSkipRootW(PCWSTR pszPath, PCWSTR* ppszRootEnd);
+
+WINPR_API HRESULT PathCchStripToRootA(PSTR pszPath, size_t cchPath);
+WINPR_API HRESULT PathCchStripToRootW(PWSTR pszPath, size_t cchPath);
+
+WINPR_API HRESULT PathCchStripPrefixA(PSTR pszPath, size_t cchPath);
+WINPR_API HRESULT PathCchStripPrefixW(PWSTR pszPath, size_t cchPath);
+
+WINPR_API HRESULT PathCchRemoveFileSpecA(PSTR pszPath, size_t cchPath);
+WINPR_API HRESULT PathCchRemoveFileSpecW(PWSTR pszPath, size_t cchPath);
+
+#ifdef UNICODE
+#define PathCchAddBackslash            PathCchAddBackslashW
+#define PathCchRemoveBackslash         PathCchRemoveBackslashW
+#define PathCchAddBackslashEx          PathCchAddBackslashExW
+#define PathCchRemoveBackslashEx       PathCchRemoveBackslashExW
+#define PathCchAddExtension            PathCchAddExtensionW
+#define PathCchAppend                  PathCchAppendW
+#define PathCchAppendEx                        PathCchAppendExW
+#define PathCchCanonicalize            PathCchCanonicalizeW
+#define PathCchCanonicalizeEx          PathCchCanonicalizeExW
+#define PathAllocCanonicalize          PathAllocCanonicalizeW
+#define PathCchCombine                 PathCchCombineW
+#define PathCchCombineEx               PathCchCombineExW
+#define PathAllocCombine               PathAllocCombineW
+#define PathCchFindExtension           PathCchFindExtensionW
+#define PathCchRenameExtension         PathCchRenameExtensionW
+#define PathCchRemoveExtension         PathCchRemoveExtensionW
+#define PathCchIsRoot                  PathCchIsRootW
+#define PathIsUNCEx                    PathIsUNCExW
+#define PathCchSkipRoot                        PathCchSkipRootW
+#define PathCchStripToRoot             PathCchStripToRootW
+#define PathCchStripPrefix             PathCchStripPrefixW
+#define PathCchRemoveFileSpec          PathCchRemoveFileSpecW
+#else
+#define PathCchAddBackslash            PathCchAddBackslashA
+#define PathCchRemoveBackslash         PathCchRemoveBackslashA
+#define PathCchAddBackslashEx          PathCchAddBackslashExA
+#define PathCchRemoveBackslashEx       PathCchRemoveBackslashExA
+#define PathCchAddExtension            PathCchAddExtensionA
+#define PathCchAppend                  PathCchAppendA
+#define PathCchAppendEx                        PathCchAppendExA
+#define PathCchCanonicalize            PathCchCanonicalizeA
+#define PathCchCanonicalizeEx          PathCchCanonicalizeExA
+#define PathAllocCanonicalize          PathAllocCanonicalizeA
+#define PathCchCombine                 PathCchCombineA
+#define PathCchCombineEx               PathCchCombineExA
+#define PathAllocCombine               PathAllocCombineA
+#define PathCchFindExtension           PathCchFindExtensionA
+#define PathCchRenameExtension         PathCchRenameExtensionA
+#define PathCchRemoveExtension         PathCchRemoveExtensionA
+#define PathCchIsRoot                  PathCchIsRootA
+#define PathIsUNCEx                    PathIsUNCExA
+#define PathCchSkipRoot                        PathCchSkipRootA
+#define PathCchStripToRoot             PathCchStripToRootA
+#define PathCchStripPrefix             PathCchStripPrefixA
+#define PathCchRemoveFileSpec          PathCchRemoveFileSpecA
+#endif
+
+#endif /* WINPR_PATH_H */
index 0078cc9..9b3cedc 100644 (file)
@@ -41,6 +41,8 @@ typedef CHAR          TCHAR;
 #define _tcscmp                strcmp
 #endif
 
+typedef TCHAR *LPTSTR, *LPTCH;
+
 #endif
 
 #endif /* WINPR_TCHAR_H */
index ba897a0..ea4b3f9 100644 (file)
@@ -90,6 +90,9 @@ typedef const CHAR *LPCSTR,*PCSTR;
 typedef WCHAR* LPWSTR, *PWSTR;
 typedef const WCHAR *LPCWSTR,*PCWSTR;
 
+typedef CHAR *LPSTR, *LPCH;
+typedef WCHAR *LPWSTR, *LPWCH;
+
 typedef unsigned __int64 QWORD;
 typedef UCHAR* STRING;
 
index 070776e..a443139 100644 (file)
@@ -28,6 +28,8 @@ endif()
 add_subdirectory(crt)
 add_subdirectory(utils)
 add_subdirectory(heap)
+add_subdirectory(path)
+add_subdirectory(environment)
 add_subdirectory(interlocked)
 add_subdirectory(handle)
 add_subdirectory(synch)
@@ -50,6 +52,8 @@ if(WITH_MONOLITHIC_BUILD)
                $<TARGET_OBJECTS:winpr-crt>
                $<TARGET_OBJECTS:winpr-utils>
                $<TARGET_OBJECTS:winpr-heap>
+               $<TARGET_OBJECTS:winpr-path>
+               $<TARGET_OBJECTS:winpr-environment>
                $<TARGET_OBJECTS:winpr-interlocked>
                $<TARGET_OBJECTS:winpr-handle>
                $<TARGET_OBJECTS:winpr-synch>
diff --git a/winpr/libwinpr/environment/CMakeLists.txt b/winpr/libwinpr/environment/CMakeLists.txt
new file mode 100644 (file)
index 0000000..80c1504
--- /dev/null
@@ -0,0 +1,37 @@
+# WinPR: Windows Portable Runtime
+# libwinpr-environment cmake build script
+#
+# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set(MODULE_NAME "winpr-environment")
+set(MODULE_PREFIX "WINPR_ENVIRONMENT")
+
+set(${MODULE_PREFIX}_SRCS
+       environment.c)
+
+if(WITH_MONOLITHIC_BUILD)
+       add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS})
+else()
+       add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
+endif()
+
+set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib")
+
+if(WITH_MONOLITHIC_BUILD)
+
+else()
+       install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
+
diff --git a/winpr/libwinpr/environment/ModuleOptions.cmake b/winpr/libwinpr/environment/ModuleOptions.cmake
new file mode 100644 (file)
index 0000000..d7b39ae
--- /dev/null
@@ -0,0 +1,9 @@
+
+set(MINWIN_LAYER "1")
+set(MINWIN_GROUP "core")
+set(MINWIN_MAJOR_VERSION "2")
+set(MINWIN_MINOR_VERSION "0")
+set(MINWIN_SHORT_NAME "processenvironment")
+set(MINWIN_LONG_NAME "Process Environment Functions")
+set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")
+
diff --git a/winpr/libwinpr/environment/environment.c b/winpr/libwinpr/environment/environment.c
new file mode 100644 (file)
index 0000000..906198b
--- /dev/null
@@ -0,0 +1,194 @@
+/**
+ * WinPR: Windows Portable Runtime
+ * Process Environment Functions
+ *
+ * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <winpr/environment.h>
+
+#ifndef _WIN32
+
+#include <winpr/crt.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+DWORD GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer)
+{
+       char* cwd;
+       int length;
+
+       cwd = getcwd(NULL, 0);
+
+       if (!cwd)
+               return 0;
+
+       length = strlen(cwd);
+
+       if ((nBufferLength == 0) && (lpBuffer == NULL))
+       {
+               free(cwd);
+
+               return (DWORD) length;
+       }
+       else
+       {
+               if (lpBuffer == NULL)
+               {
+                       free(cwd);
+                       return 0;
+               }
+
+               if ((length + 1) > nBufferLength)
+               {
+                       free(cwd);
+                       return (DWORD) (length + 1);
+               }
+
+               memcpy(lpBuffer, cwd, length + 1);
+               return length;
+       }
+
+       return 0;
+}
+
+DWORD GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer)
+{
+       return 0;
+}
+
+BOOL SetCurrentDirectoryA(LPCSTR lpPathName)
+{
+       return TRUE;
+}
+
+BOOL SetCurrentDirectoryW(LPCWSTR lpPathName)
+{
+       return TRUE;
+}
+
+DWORD SearchPathA(LPCSTR lpPath, LPCSTR lpFileName, LPCSTR lpExtension, DWORD nBufferLength, LPSTR lpBuffer, LPSTR* lpFilePart)
+{
+       return 0;
+}
+
+DWORD SearchPathW(LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR* lpFilePart)
+{
+       return 0;
+}
+
+HANDLE GetStdHandle(DWORD nStdHandle)
+{
+       return NULL;
+}
+
+BOOL SetStdHandle(DWORD nStdHandle, HANDLE hHandle)
+{
+       return TRUE;
+}
+
+BOOL SetStdHandleEx(DWORD dwStdHandle, HANDLE hNewHandle, HANDLE* phOldHandle)
+{
+       return TRUE;
+}
+
+LPSTR GetCommandLineA(VOID)
+{
+       return NULL;
+}
+
+LPWSTR GetCommandLineW(VOID)
+{
+       return NULL;
+}
+
+BOOL NeedCurrentDirectoryForExePathA(LPCSTR ExeName)
+{
+       return TRUE;
+}
+
+BOOL NeedCurrentDirectoryForExePathW(LPCWSTR ExeName)
+{
+       return TRUE;
+}
+
+DWORD GetEnvironmentVariableA(LPCSTR lpName, LPSTR lpBuffer, DWORD nSize)
+{
+       return 0;
+}
+
+DWORD GetEnvironmentVariableW(LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize)
+{
+       return 0;
+}
+
+BOOL SetEnvironmentVariableA(LPCSTR lpName, LPCSTR lpValue)
+{
+       return TRUE;
+}
+
+BOOL SetEnvironmentVariableW(LPCWSTR lpName, LPCWSTR lpValue)
+{
+       return TRUE;
+}
+
+LPCH GetEnvironmentStrings(VOID)
+{
+       return NULL;
+}
+
+LPWCH GetEnvironmentStringsW(VOID)
+{
+       return NULL;
+}
+
+BOOL SetEnvironmentStringsA(LPCH NewEnvironment)
+{
+       return TRUE;
+}
+
+BOOL SetEnvironmentStringsW(LPWCH NewEnvironment)
+{
+       return TRUE;
+}
+
+DWORD ExpandEnvironmentStringsA(LPCSTR lpSrc, LPSTR lpDst, DWORD nSize)
+{
+       return 0;
+}
+
+DWORD ExpandEnvironmentStringsW(LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize)
+{
+       return 0;
+}
+
+BOOL FreeEnvironmentStringsA(LPCH lpszEnvironmentBlock)
+{
+       return TRUE;
+}
+
+BOOL FreeEnvironmentStringsW(LPWCH lpszEnvironmentBlock)
+{
+       return TRUE;
+}
+
+#endif
+
index 9688076..b5e3860 100644 (file)
@@ -27,6 +27,8 @@
  * api-ms-win-core-libraryloader-l1-1-1.dll:
  *
  * AddDllDirectory
+ * RemoveDllDirectory
+ * SetDefaultDllDirectories
  * DisableThreadLibraryCalls
  * EnumResourceLanguagesExA
  * EnumResourceLanguagesExW
  * LoadStringW
  * LockResource
  * QueryOptionalDelayLoadedAPI
- * RemoveDllDirectory
- * SetDefaultDllDirectories
  * SizeofResource
  */
 
+DLL_DIRECTORY_COOKIE AddDllDirectory(PCWSTR NewDirectory)
+{
+       return NULL;
+}
+
+BOOL RemoveDllDirectory(DLL_DIRECTORY_COOKIE Cookie)
+{
+       return TRUE;
+}
+
+BOOL SetDefaultDllDirectories(DWORD DirectoryFlags)
+{
+       return TRUE;
+}
+
 #ifndef _WIN32
 
 #include <dlfcn.h>
diff --git a/winpr/libwinpr/path/CMakeLists.txt b/winpr/libwinpr/path/CMakeLists.txt
new file mode 100644 (file)
index 0000000..559edc9
--- /dev/null
@@ -0,0 +1,37 @@
+# WinPR: Windows Portable Runtime
+# libwinpr-path cmake build script
+#
+# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set(MODULE_NAME "winpr-path")
+set(MODULE_PREFIX "WINPR_PATH")
+
+set(${MODULE_PREFIX}_SRCS
+       path.c)
+
+if(WITH_MONOLITHIC_BUILD)
+       add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS})
+else()
+       add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
+endif()
+
+set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib")
+
+if(WITH_MONOLITHIC_BUILD)
+
+else()
+       install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
+
diff --git a/winpr/libwinpr/path/ModuleOptions.cmake b/winpr/libwinpr/path/ModuleOptions.cmake
new file mode 100644 (file)
index 0000000..b330a21
--- /dev/null
@@ -0,0 +1,9 @@
+
+set(MINWIN_LAYER "1")
+set(MINWIN_GROUP "core")
+set(MINWIN_MAJOR_VERSION "1")
+set(MINWIN_MINOR_VERSION "0")
+set(MINWIN_SHORT_NAME "path")
+set(MINWIN_LONG_NAME "Path Functions")
+set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")
+
diff --git a/winpr/libwinpr/path/path.c b/winpr/libwinpr/path/path.c
new file mode 100644 (file)
index 0000000..bc54e34
--- /dev/null
@@ -0,0 +1,245 @@
+/**
+ * WinPR: Windows Portable Runtime
+ * Path Functions
+ *
+ * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <winpr/path.h>
+
+HRESULT PathCchAddBackslashA(PSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+
+HRESULT PathCchAddBackslashW(PWSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+
+HRESULT PathCchRemoveBackslashA(PSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+
+HRESULT PathCchRemoveBackslashW(PWSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+
+HRESULT PathCchAddBackslashExA(PSTR pszPath, size_t cchPath, PSTR* ppszEnd, size_t* pcchRemaining)
+{
+       return 0;
+}
+
+HRESULT PathCchAddBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd, size_t* pcchRemaining)
+{
+       return 0;
+}
+
+HRESULT PathCchRemoveBackslashExA(PSTR pszPath, size_t cchPath, PSTR* ppszEnd, size_t* pcchRemaining)
+{
+       return 0;
+}
+
+HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd, size_t* pcchRemaining)
+{
+       return 0;
+}
+
+HRESULT PathCchAddExtensionA(PSTR pszPath, size_t cchPath, PCSTR pszExt)
+{
+       return 0;
+}
+
+HRESULT PathCchAddExtensionW(PWSTR pszPath, size_t cchPath, PCWSTR pszExt)
+{
+       return 0;
+}
+
+HRESULT PathCchAppendA(PSTR pszPath, size_t cchPath, PCSTR pszMore)
+{
+       return 0;
+}
+
+HRESULT PathCchAppendW(PWSTR pszPath, size_t cchPath, PCWSTR pszMore)
+{
+       return 0;
+}
+
+HRESULT PathCchAppendExA(PSTR pszPath, size_t cchPath, PCSTR pszMore, unsigned long dwFlags)
+{
+       return 0;
+}
+
+HRESULT PathCchAppendExW(PWSTR pszPath, size_t cchPath, PCWSTR pszMore, unsigned long dwFlags)
+{
+       return 0;
+}
+
+HRESULT PathCchCanonicalizeA(PSTR pszPathOut, size_t cchPathOut, PCSTR pszPathIn)
+{
+       return 0;
+}
+
+HRESULT PathCchCanonicalizeW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn)
+{
+       return 0;
+}
+
+HRESULT PathCchCanonicalizeExA(PSTR pszPathOut, size_t cchPathOut, PCSTR pszPathIn, unsigned long dwFlags)
+{
+       return 0;
+}
+
+HRESULT PathCchCanonicalizeExW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn, unsigned long dwFlags)
+{
+       return 0;
+}
+
+HRESULT PathAllocCanonicalizeA(PCSTR pszPathIn, unsigned long dwFlags, PSTR* ppszPathOut)
+{
+       return 0;
+}
+
+HRESULT PathAllocCanonicalizeW(PCWSTR pszPathIn, unsigned long dwFlags, PWSTR* ppszPathOut)
+{
+       return 0;
+}
+
+HRESULT PathCchCombineA(PSTR pszPathOut, size_t cchPathOut, PCSTR pszPathIn, PCSTR pszMore)
+{
+       return 0;
+}
+
+HRESULT PathCchCombineW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn, PCWSTR pszMore)
+{
+       return 0;
+}
+
+HRESULT PathCchCombineExA(PSTR pszPathOut, size_t cchPathOut, PCSTR pszPathIn, PCSTR pszMore, unsigned long dwFlags)
+{
+       return 0;
+}
+
+HRESULT PathCchCombineExW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn, PCWSTR pszMore, unsigned long dwFlags)
+{
+       return 0;
+}
+
+HRESULT PathAllocCombineA(PCSTR pszPathIn, PCSTR pszMore, unsigned long dwFlags, PSTR* ppszPathOut)
+{
+       return 0;
+}
+
+HRESULT PathAllocCombineW(PCWSTR pszPathIn, PCWSTR pszMore, unsigned long dwFlags, PWSTR* ppszPathOut)
+{
+       return 0;
+}
+
+HRESULT PathCchFindExtensionA(PCSTR pszPath, size_t cchPath, PCSTR* ppszExt)
+{
+       return 0;
+}
+
+HRESULT PathCchFindExtensionW(PCWSTR pszPath, size_t cchPath, PCWSTR* ppszExt)
+{
+       return 0;
+}
+
+HRESULT PathCchRenameExtensionA(PSTR pszPath, size_t cchPath, PCSTR pszExt)
+{
+       return 0;
+}
+
+HRESULT PathCchRenameExtensionW(PWSTR pszPath, size_t cchPath, PCWSTR pszExt)
+{
+       return 0;
+}
+
+HRESULT PathCchRemoveExtensionA(PSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+
+HRESULT PathCchRemoveExtensionW(PWSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+
+BOOL PathCchIsRootA(PCSTR pszPath)
+{
+       return 0;
+}
+
+BOOL PathCchIsRootW(PCWSTR pszPath)
+{
+       return 0;
+}
+
+BOOL PathIsUNCExA(PCSTR pszPath, PCSTR* ppszServer)
+{
+       return 0;
+}
+
+BOOL PathIsUNCExW(PCWSTR pszPath, PCWSTR* ppszServer)
+{
+       return 0;
+}
+
+HRESULT PathCchSkipRootA(PCSTR pszPath, PCSTR* ppszRootEnd)
+{
+       return 0;
+}
+
+HRESULT PathCchSkipRootW(PCWSTR pszPath, PCWSTR* ppszRootEnd)
+{
+       return 0;
+}
+
+HRESULT PathCchStripToRootA(PSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+
+HRESULT PathCchStripToRootW(PWSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+
+HRESULT PathCchStripPrefixA(PSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+
+HRESULT PathCchStripPrefixW(PWSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+
+HRESULT PathCchRemoveFileSpecA(PSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+
+HRESULT PathCchRemoveFileSpecW(PWSTR pszPath, size_t cchPath)
+{
+       return 0;
+}
+