libwinpr: stubbed Path API
This commit is contained in:
parent
6cb933aa5a
commit
90ffa6ea86
92
winpr/include/winpr/environment.h
Normal file
92
winpr/include/winpr/environment.h
Normal file
@ -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 */
|
||||
|
@ -23,6 +23,17 @@
|
||||
#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);
|
||||
|
140
winpr/include/winpr/path.h
Normal file
140
winpr/include/winpr/path.h
Normal file
@ -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 */
|
@ -41,6 +41,8 @@ typedef CHAR TCHAR;
|
||||
#define _tcscmp strcmp
|
||||
#endif
|
||||
|
||||
typedef TCHAR *LPTSTR, *LPTCH;
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* WINPR_TCHAR_H */
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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>
|
||||
|
37
winpr/libwinpr/environment/CMakeLists.txt
Normal file
37
winpr/libwinpr/environment/CMakeLists.txt
Normal file
@ -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()
|
||||
|
9
winpr/libwinpr/environment/ModuleOptions.cmake
Normal file
9
winpr/libwinpr/environment/ModuleOptions.cmake
Normal file
@ -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}")
|
||||
|
194
winpr/libwinpr/environment/environment.c
Normal file
194
winpr/libwinpr/environment/environment.c
Normal file
@ -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
|
||||
|
@ -27,6 +27,8 @@
|
||||
* api-ms-win-core-libraryloader-l1-1-1.dll:
|
||||
*
|
||||
* AddDllDirectory
|
||||
* RemoveDllDirectory
|
||||
* SetDefaultDllDirectories
|
||||
* DisableThreadLibraryCalls
|
||||
* EnumResourceLanguagesExA
|
||||
* EnumResourceLanguagesExW
|
||||
@ -53,11 +55,24 @@
|
||||
* 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>
|
||||
|
37
winpr/libwinpr/path/CMakeLists.txt
Normal file
37
winpr/libwinpr/path/CMakeLists.txt
Normal file
@ -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()
|
||||
|
9
winpr/libwinpr/path/ModuleOptions.cmake
Normal file
9
winpr/libwinpr/path/ModuleOptions.cmake
Normal file
@ -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}")
|
||||
|
245
winpr/libwinpr/path/path.c
Normal file
245
winpr/libwinpr/path/path.c
Normal file
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user