Now using macro to generate module specific log tag.

This commit is contained in:
Armin Novak 2014-08-18 18:57:08 +02:00 committed by Armin Novak
parent 0ec5318c99
commit 7e3a1b3073
37 changed files with 412 additions and 337 deletions

View File

@ -43,7 +43,7 @@
#endif
#include "../log.h"
#define TAG "crt"
#define TAG WINPR_TAG("crt")
struct winpr_aligned_mem
{
@ -126,7 +126,7 @@ void *_aligned_offset_realloc(void *memblock, size_t size, size_t alignment, siz
if (pMem->sig != WINPR_ALIGNED_MEM_SIGNATURE)
{
WLog_ERR(TAG, "_aligned_offset_realloc: memory block was not allocated by _aligned_malloc!\n");
WLog_ERR(TAG, "_aligned_offset_realloc: memory block was not allocated by _aligned_malloc!");
return NULL;
}
@ -161,7 +161,7 @@ void *_aligned_offset_recalloc(void *memblock, size_t num, size_t size, size_t a
if (pMem->sig != WINPR_ALIGNED_MEM_SIGNATURE)
{
WLog_ERR(TAG, "_aligned_offset_recalloc: memory block was not allocated by _aligned_malloc!\n");
WLog_ERR(TAG, "_aligned_offset_recalloc: memory block was not allocated by _aligned_malloc!");
return NULL;
}
@ -181,7 +181,7 @@ size_t _aligned_msize(void *memblock, size_t alignment, size_t offset)
if (pMem->sig != WINPR_ALIGNED_MEM_SIGNATURE)
{
WLog_ERR(TAG, "_aligned_msize: memory block was not allocated by _aligned_malloc!\n");
WLog_ERR(TAG, "_aligned_msize: memory block was not allocated by _aligned_malloc!");
return 0;
}
@ -199,7 +199,7 @@ void _aligned_free(void *memblock)
if (pMem->sig != WINPR_ALIGNED_MEM_SIGNATURE)
{
WLog_ERR(TAG, "_aligned_free: memory block was not allocated by _aligned_malloc!\n");
WLog_ERR(TAG, "_aligned_free: memory block was not allocated by _aligned_malloc!");
return;
}

View File

@ -33,7 +33,7 @@
#include "casing.c"
#include "../log.h"
#define TAG "crt"
#define TAG WINPR_TAG("crt")
char *_strdup(const char *strSource)
{
@ -194,7 +194,7 @@ LPSTR CharUpperA(LPSTR lpsz)
LPWSTR CharUpperW(LPWSTR lpsz)
{
WLog_ERR(TAG, "CharUpperW unimplemented!\n");
WLog_ERR(TAG, "CharUpperW unimplemented!");
return (LPWSTR) NULL;
}
@ -261,7 +261,7 @@ LPSTR CharLowerA(LPSTR lpsz)
LPWSTR CharLowerW(LPWSTR lpsz)
{
WLog_ERR(TAG, "CharLowerW unimplemented!\n");
WLog_ERR(TAG, "CharLowerW unimplemented!");
return (LPWSTR) NULL;
}
@ -303,7 +303,7 @@ BOOL IsCharAlphaA(CHAR ch)
BOOL IsCharAlphaW(WCHAR ch)
{
WLog_ERR(TAG, "IsCharAlphaW unimplemented!\n");
WLog_ERR(TAG, "IsCharAlphaW unimplemented!");
return 0;
}
@ -318,7 +318,7 @@ BOOL IsCharAlphaNumericA(CHAR ch)
BOOL IsCharAlphaNumericW(WCHAR ch)
{
WLog_ERR(TAG, "IsCharAlphaNumericW unimplemented!\n");
WLog_ERR(TAG, "IsCharAlphaNumericW unimplemented!");
return 0;
}
@ -332,7 +332,7 @@ BOOL IsCharUpperA(CHAR ch)
BOOL IsCharUpperW(WCHAR ch)
{
WLog_ERR(TAG, "IsCharUpperW unimplemented!\n");
WLog_ERR(TAG, "IsCharUpperW unimplemented!");
return 0;
}
@ -346,7 +346,7 @@ BOOL IsCharLowerA(CHAR ch)
BOOL IsCharLowerW(WCHAR ch)
{
WLog_ERR(TAG, "IsCharLowerW unimplemented!\n");
WLog_ERR(TAG, "IsCharLowerW unimplemented!");
return 0;
}

View File

@ -41,7 +41,7 @@
#endif
#include "../log.h"
#define TAG "file"
#define TAG WINPR_TAG("file")
/**
* api-ms-win-core-file-l1-2-0.dll:
@ -204,13 +204,9 @@ static pthread_once_t _HandleCreatorsInitialized = PTHREAD_ONCE_INIT;
static void _HandleCreatorsInit()
{
/* NB: error management to be done outside of this function */
assert(_HandleCreators == NULL);
_HandleCreators = (HANDLE_CREATOR**)calloc(HANDLE_CREATOR_MAX+1, sizeof(HANDLE_CREATOR*));
_HandleCreators = (HANDLE_CREATOR **)calloc(HANDLE_CREATOR_MAX+1, sizeof(HANDLE_CREATOR *));
InitializeCriticalSection(&_HandleCreatorsLock);
assert(_HandleCreators != NULL);
}
@ -237,7 +233,6 @@ BOOL RegisterHandleCreator(PHANDLE_CREATOR pHandleCreator)
return FALSE;
}
EnterCriticalSection(&_HandleCreatorsLock);
for (i=0; i<HANDLE_CREATOR_MAX; i++)
@ -245,15 +240,12 @@ BOOL RegisterHandleCreator(PHANDLE_CREATOR pHandleCreator)
if (_HandleCreators[i] == NULL)
{
_HandleCreators[i] = pHandleCreator;
LeaveCriticalSection(&_HandleCreatorsLock);
return TRUE;
}
}
SetLastError(ERROR_INSUFFICIENT_BUFFER);
LeaveCriticalSection(&_HandleCreatorsLock);
return FALSE;
}
@ -263,7 +255,7 @@ BOOL RegisterHandleCreator(PHANDLE_CREATOR pHandleCreator)
static BOOL g_AioSignalHandlerInstalled = FALSE;
void AioSignalHandler(int signum, siginfo_t* siginfo, void* arg)
void AioSignalHandler(int signum, siginfo_t *siginfo, void *arg)
{
WLog_INFO("%d", signum);
}
@ -273,15 +265,11 @@ int InstallAioSignalHandler()
if (!g_AioSignalHandlerInstalled)
{
struct sigaction action;
sigemptyset(&action.sa_mask);
sigaddset(&action.sa_mask, SIGIO);
action.sa_flags = SA_SIGINFO;
action.sa_sigaction = (void*) &AioSignalHandler;
action.sa_sigaction = (void *) &AioSignalHandler;
sigaction(SIGIO, &action, NULL);
g_AioSignalHandlerInstalled = TRUE;
}
@ -294,11 +282,11 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
int i;
char* name;
char *name;
int status;
HANDLE hNamedPipe;
struct sockaddr_un s;
WINPR_NAMED_PIPE* pNamedPipe;
WINPR_NAMED_PIPE *pNamedPipe;
if (!lpFileName)
return INVALID_HANDLE_VALUE;
@ -319,12 +307,12 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
for (i=0; _HandleCreators[i] != NULL; i++)
{
HANDLE_CREATOR *creator = (HANDLE_CREATOR*)_HandleCreators[i];
HANDLE_CREATOR *creator = (HANDLE_CREATOR *)_HandleCreators[i];
if (creator && creator->IsHandled(lpFileName))
{
HANDLE newHandle = creator->CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes,
dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
LeaveCriticalSection(&_HandleCreatorsLock);
return newHandle;
}
@ -343,12 +331,9 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
return INVALID_HANDLE_VALUE;
free(name);
pNamedPipe = (WINPR_NAMED_PIPE*) calloc(1, sizeof(WINPR_NAMED_PIPE));
pNamedPipe = (WINPR_NAMED_PIPE *) calloc(1, sizeof(WINPR_NAMED_PIPE));
hNamedPipe = (HANDLE) pNamedPipe;
WINPR_HANDLE_SET_TYPE(pNamedPipe, HANDLE_TYPE_NAMED_PIPE);
pNamedPipe->name = _strdup(lpFileName);
pNamedPipe->dwOpenMode = 0;
pNamedPipe->dwPipeMode = 0;
@ -357,26 +342,22 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
pNamedPipe->nInBufferSize = 0;
pNamedPipe->nDefaultTimeOut = 0;
pNamedPipe->dwFlagsAndAttributes = dwFlagsAndAttributes;
pNamedPipe->lpFileName = GetNamedPipeNameWithoutPrefixA(lpFileName);
pNamedPipe->lpFilePath = GetNamedPipeUnixDomainSocketFilePathA(lpFileName);
pNamedPipe->clientfd = socket(PF_LOCAL, SOCK_STREAM, 0);
pNamedPipe->serverfd = -1;
pNamedPipe->ServerMode = FALSE;
ZeroMemory(&s, sizeof(struct sockaddr_un));
s.sun_family = AF_UNIX;
strcpy(s.sun_path, pNamedPipe->lpFilePath);
status = connect(pNamedPipe->clientfd, (struct sockaddr*) &s, sizeof(struct sockaddr_un));
status = connect(pNamedPipe->clientfd, (struct sockaddr *) &s, sizeof(struct sockaddr_un));
if (status != 0)
{
close(pNamedPipe->clientfd);
free((char*) pNamedPipe->name);
free((char*) pNamedPipe->lpFileName);
free((char*) pNamedPipe->lpFilePath);
free((char *) pNamedPipe->name);
free((char *) pNamedPipe->lpFileName);
free((char *) pNamedPipe->lpFilePath);
free(pNamedPipe);
return INVALID_HANDLE_VALUE;
}
@ -388,6 +369,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
if (flags != -1)
fcntl(pNamedPipe->clientfd, F_SETFL, flags | O_NONBLOCK);
#endif
}
@ -403,9 +385,7 @@ HANDLE CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
BOOL DeleteFileA(LPCSTR lpFileName)
{
int status;
status = unlink(lpFileName);
return (status != -1) ? TRUE : FALSE;
}
@ -421,7 +401,8 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
PVOID Object;
BOOL status = TRUE;
if (hFile == INVALID_HANDLE_VALUE) {
if (hFile == INVALID_HANDLE_VALUE)
{
return FALSE;
}
@ -439,9 +420,8 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
if (Type == HANDLE_TYPE_ANONYMOUS_PIPE)
{
int io_status;
WINPR_PIPE* pipe;
pipe = (WINPR_PIPE*) Object;
WINPR_PIPE *pipe;
pipe = (WINPR_PIPE *) Object;
do
{
@ -469,9 +449,8 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
else if (Type == HANDLE_TYPE_NAMED_PIPE)
{
int io_status;
WINPR_NAMED_PIPE* pipe;
pipe = (WINPR_NAMED_PIPE*) Object;
WINPR_NAMED_PIPE *pipe;
pipe = (WINPR_NAMED_PIPE *) Object;
if (!(pipe->dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
{
@ -498,6 +477,7 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
case EWOULDBLOCK:
SetLastError(ERROR_NO_DATA);
break;
default:
SetLastError(ERROR_BROKEN_PIPE);
break;
@ -509,7 +489,6 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
else
{
/* Overlapped I/O */
if (!lpOverlapped)
return FALSE;
@ -517,26 +496,20 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
return FALSE;
pipe->lpOverlapped = lpOverlapped;
#ifdef HAVE_AIO_H
{
int aio_status;
struct aiocb cb;
ZeroMemory(&cb, sizeof(struct aiocb));
cb.aio_fildes = pipe->clientfd;
cb.aio_buf = lpBuffer;
cb.aio_nbytes = nNumberOfBytesToRead;
cb.aio_offset = lpOverlapped->Offset;
cb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
cb.aio_sigevent.sigev_signo = SIGIO;
cb.aio_sigevent.sigev_value.sival_ptr = (void*) lpOverlapped;
cb.aio_sigevent.sigev_value.sival_ptr = (void *) lpOverlapped;
InstallAioSignalHandler();
aio_status = aio_read(&cb);
WLog_DBG(TAG, "aio_read status: %d", aio_status);
if (aio_status < 0)
@ -545,15 +518,11 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
return status;
}
#else
/* synchronous behavior */
lpOverlapped->Internal = 0;
lpOverlapped->InternalHigh = (ULONG_PTR) nNumberOfBytesToRead;
lpOverlapped->Pointer = (PVOID) lpBuffer;
SetEvent(lpOverlapped->hEvent);
#endif
}
@ -582,7 +551,8 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
PVOID Object;
BOOL status = TRUE;
if (hFile == INVALID_HANDLE_VALUE) {
if (hFile == INVALID_HANDLE_VALUE)
{
return FALSE;
}
@ -592,9 +562,8 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
if (Type == HANDLE_TYPE_ANONYMOUS_PIPE)
{
int io_status;
WINPR_PIPE* pipe;
pipe = (WINPR_PIPE*) Object;
WINPR_PIPE *pipe;
pipe = (WINPR_PIPE *) Object;
do
{
@ -606,15 +575,13 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
io_status = 0;
*lpNumberOfBytesWritten = io_status;
return TRUE;
}
else if (Type == HANDLE_TYPE_NAMED_PIPE)
{
int io_status;
WINPR_NAMED_PIPE* pipe;
pipe = (WINPR_NAMED_PIPE*) Object;
WINPR_NAMED_PIPE *pipe;
pipe = (WINPR_NAMED_PIPE *) Object;
if (!(pipe->dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
{
@ -633,12 +600,13 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
{
*lpNumberOfBytesWritten = 0;
switch(errno)
switch (errno)
{
case EWOULDBLOCK:
io_status = 0;
status = TRUE;
break;
default:
status = FALSE;
}
@ -650,7 +618,6 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
else
{
/* Overlapped I/O */
if (!lpOverlapped)
return FALSE;
@ -658,25 +625,19 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
return FALSE;
pipe->lpOverlapped = lpOverlapped;
#ifdef HAVE_AIO_H
{
struct aiocb cb;
ZeroMemory(&cb, sizeof(struct aiocb));
cb.aio_fildes = pipe->clientfd;
cb.aio_buf = (void*) lpBuffer;
cb.aio_buf = (void *) lpBuffer;
cb.aio_nbytes = nNumberOfBytesToWrite;
cb.aio_offset = lpOverlapped->Offset;
cb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
cb.aio_sigevent.sigev_signo = SIGIO;
cb.aio_sigevent.sigev_value.sival_ptr = (void*) lpOverlapped;
cb.aio_sigevent.sigev_value.sival_ptr = (void *) lpOverlapped;
InstallAioSignalHandler();
io_status = aio_write(&cb);
WLog_DBG("aio_write status: %d", io_status);
if (io_status < 0)
@ -685,15 +646,11 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
return status;
}
#else
/* synchronous behavior */
lpOverlapped->Internal = 1;
lpOverlapped->InternalHigh = (ULONG_PTR) nNumberOfBytesToWrite;
lpOverlapped->Pointer = (PVOID) lpBuffer;
SetEvent(lpOverlapped->hEvent);
#endif
}
@ -763,28 +720,24 @@ BOOL UnlockFileEx(HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLo
struct _WIN32_FILE_SEARCH
{
DIR* pDir;
DIR *pDir;
LPSTR lpPath;
LPSTR lpPattern;
struct dirent* pDirent;
struct dirent *pDirent;
};
typedef struct _WIN32_FILE_SEARCH WIN32_FILE_SEARCH;
HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
{
char* p;
char *p;
int index;
int length;
struct stat fileStat;
WIN32_FILE_SEARCH* pFileSearch;
WIN32_FILE_SEARCH *pFileSearch;
ZeroMemory(lpFindFileData, sizeof(WIN32_FIND_DATAA));
pFileSearch = (WIN32_FILE_SEARCH*) malloc(sizeof(WIN32_FILE_SEARCH));
pFileSearch = (WIN32_FILE_SEARCH *) malloc(sizeof(WIN32_FILE_SEARCH));
ZeroMemory(pFileSearch, sizeof(WIN32_FILE_SEARCH));
/* Separate lpFileName into path and pattern components */
p = strrchr(lpFileName, '/');
if (!p)
@ -795,7 +748,6 @@ HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
pFileSearch->lpPath = (LPSTR) malloc(length + 1);
CopyMemory(pFileSearch->lpPath, lpFileName, length);
pFileSearch->lpPath[length] = '\0';
length = strlen(lpFileName) - index;
pFileSearch->lpPattern = (LPSTR) malloc(length + 1);
CopyMemory(pFileSearch->lpPattern, &lpFileName[index + 1], length);
@ -816,7 +768,6 @@ HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
}
/* Open directory for reading */
pFileSearch->pDir = opendir(pFileSearch->lpPath);
if (!pFileSearch->pDir)
@ -863,7 +814,7 @@ HANDLE FindFirstFileExW(LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPV
BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData)
{
WIN32_FILE_SEARCH* pFileSearch;
WIN32_FILE_SEARCH *pFileSearch;
if (!hFindFile)
return FALSE;
@ -871,7 +822,7 @@ BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData)
if (hFindFile == INVALID_HANDLE_VALUE)
return FALSE;
pFileSearch = (WIN32_FILE_SEARCH*) hFindFile;
pFileSearch = (WIN32_FILE_SEARCH *) hFindFile;
while ((pFileSearch->pDirent = readdir(pFileSearch->pDir)) != NULL)
{
@ -892,20 +843,21 @@ BOOL FindNextFileW(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData)
BOOL FindClose(HANDLE hFindFile)
{
WIN32_FILE_SEARCH* pFileSearch;
pFileSearch = (WIN32_FILE_SEARCH*) hFindFile;
WIN32_FILE_SEARCH *pFileSearch;
pFileSearch = (WIN32_FILE_SEARCH *) hFindFile;
if (pFileSearch)
{
if (pFileSearch->lpPath)
free(pFileSearch->lpPath);
if (pFileSearch->lpPattern)
free(pFileSearch->lpPattern);
if (pFileSearch->pDir)
closedir(pFileSearch->pDir);
free(pFileSearch);
free(pFileSearch);
return TRUE;
}
@ -939,9 +891,9 @@ BOOL IsNamedPipeFileNameA(LPCSTR lpName)
return TRUE;
}
char* GetNamedPipeNameWithoutPrefixA(LPCSTR lpName)
char *GetNamedPipeNameWithoutPrefixA(LPCSTR lpName)
{
char* lpFileName;
char *lpFileName;
if (!lpName)
return NULL;
@ -950,37 +902,29 @@ char* GetNamedPipeNameWithoutPrefixA(LPCSTR lpName)
return NULL;
lpFileName = _strdup(&lpName[strlen(NAMED_PIPE_PREFIX_PATH)]);
return lpFileName;
}
char* GetNamedPipeUnixDomainSocketBaseFilePathA()
char *GetNamedPipeUnixDomainSocketBaseFilePathA()
{
char* lpTempPath;
char* lpPipePath;
char *lpTempPath;
char *lpPipePath;
lpTempPath = GetKnownPath(KNOWN_PATH_TEMP);
lpPipePath = GetCombinedPath(lpTempPath, ".pipe");
free(lpTempPath);
return lpPipePath;
}
char* GetNamedPipeUnixDomainSocketFilePathA(LPCSTR lpName)
char *GetNamedPipeUnixDomainSocketFilePathA(LPCSTR lpName)
{
char* lpPipePath;
char* lpFileName;
char* lpFilePath;
char *lpPipePath;
char *lpFileName;
char *lpFilePath;
lpPipePath = GetNamedPipeUnixDomainSocketBaseFilePathA();
lpFileName = GetNamedPipeNameWithoutPrefixA(lpName);
lpFilePath = GetCombinedPath(lpPipePath, (char*) lpFileName);
lpFilePath = GetCombinedPath(lpPipePath, (char *) lpFileName);
free(lpPipePath);
free(lpFileName);
return lpFilePath;
}
@ -988,26 +932,23 @@ int GetNamePipeFileDescriptor(HANDLE hNamedPipe)
{
#ifndef _WIN32
int fd;
WINPR_NAMED_PIPE* pNamedPipe;
pNamedPipe = (WINPR_NAMED_PIPE*) hNamedPipe;
WINPR_NAMED_PIPE *pNamedPipe;
pNamedPipe = (WINPR_NAMED_PIPE *) hNamedPipe;
if (!pNamedPipe || pNamedPipe->Type != HANDLE_TYPE_NAMED_PIPE)
return -1;
fd = (pNamedPipe->ServerMode) ? pNamedPipe->serverfd : pNamedPipe->clientfd;
return fd;
#else
return -1;
#endif
}
int UnixChangeFileMode(const char* filename, int flags)
int UnixChangeFileMode(const char *filename, int flags)
{
#ifndef _WIN32
mode_t fl = 0;
fl |= (flags & 0x4000) ? S_ISUID : 0;
fl |= (flags & 0x2000) ? S_ISGID : 0;
fl |= (flags & 0x1000) ? S_ISVTX : 0;
@ -1020,7 +961,6 @@ int UnixChangeFileMode(const char* filename, int flags)
fl |= (flags & 0x0004) ? S_IROTH : 0;
fl |= (flags & 0x0002) ? S_IWOTH : 0;
fl |= (flags & 0x0001) ? S_IXOTH : 0;
return chmod(filename, fl);
#else
return 0;

View File

@ -35,7 +35,7 @@
#endif
#include "../log.h"
#define TAG "file"
#define TAG WINPR_TAG("file")
/**
* File System Behavior in the Microsoft Windows Environment:
@ -189,7 +189,7 @@ BOOL FilePatternMatchSubExpressionA(LPCSTR lpFileName, size_t cchFileName,
}
else if (*lpWildcard == '~')
{
WLog_ERR(TAG, "warning: unimplemented '~' pattern match\n");
WLog_ERR(TAG, "warning: unimplemented '~' pattern match");
return TRUE;
}

View File

@ -27,7 +27,7 @@
#include <winpr/library.h>
#include "../log.h"
#define TAG "com.winpr.library"
#define TAG WINPR_TAG("library")
/**
* api-ms-win-core-libraryloader-l1-1-1.dll:
@ -99,7 +99,7 @@ HMODULE LoadLibraryA(LPCSTR lpLibFileName)
if (!library)
{
WLog_ERR(TAG, "LoadLibraryA: %s\n", dlerror());
WLog_ERR(TAG, "LoadLibraryA: %s", dlerror());
return NULL;
}
@ -118,7 +118,7 @@ HMODULE LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
if (!library)
{
WLog_ERR(TAG, "LoadLibraryExA: failed to open %s: %s\n", lpLibFileName, dlerror());
WLog_ERR(TAG, "LoadLibraryExA: failed to open %s: %s", lpLibFileName, dlerror());
return NULL;
}
@ -137,7 +137,7 @@ FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName)
if (proc == NULL)
{
WLog_ERR(TAG, "GetProcAddress: could not find procedure %s: %s\n", lpProcName, dlerror());
WLog_ERR(TAG, "GetProcAddress: could not find procedure %s: %s", lpProcName, dlerror());
return (FARPROC) NULL;
}

View File

@ -22,15 +22,13 @@
#include <winpr/wlog.h>
#define WLOG_PRINT(level, file, fkt, line, dbg_str, fmt, ...) \
#define WINPR_TAG(tag) "com.winpr." tag
#define WLOG_PRINT(level, file, fkt, line, tag, fmt, ...) \
do { \
const char *hdr = "com.winpr."; \
char tag[1024] = { 0 }; \
wLogMessage msg; \
wLog *log; \
\
strncat(tag, hdr, sizeof(tag)); \
strncat(tag, dbg_str, sizeof(tag) - sizeof(hdr)); \
log = WLog_Get(tag); \
\
msg.Type = WLOG_MESSAGE_TEXT; \

View File

@ -46,7 +46,7 @@
#include "pipe.h"
#include "../log.h"
#define TAG "pipe"
#define TAG WINPR_TAG("pipe")
/*
* Since the WinPR implementation of named pipes makes use of UNIX domain
@ -134,7 +134,7 @@ static void winpr_unref_named_pipe(WINPR_NAMED_PIPE *pNamedPipe)
assert(pNamedPipe->name);
assert(g_NamedPipeServerSockets);
//WLog_VRB(TAG, "%s: %p (%s)\n", __FUNCTION__, pNamedPipe, pNamedPipe->name);
//WLog_VRB(TAG, "%s: %p (%s)", __FUNCTION__, pNamedPipe, pNamedPipe->name);
ArrayList_Lock(g_NamedPipeServerSockets);
for (index = 0; index < ArrayList_Count(g_NamedPipeServerSockets); index++)
@ -150,8 +150,8 @@ static void winpr_unref_named_pipe(WINPR_NAMED_PIPE *pNamedPipe)
if (--baseSocket->references == 0)
{
//WLog_DBG(TAG, "%s: removing shared server socked resource\n", __FUNCTION__);
//WLog_DBG(TAG, "%s: closing shared serverfd %d\n", __FUNCTION__, baseSocket->serverfd);
//WLog_DBG(TAG, "%s: removing shared server socked resource", __FUNCTION__);
//WLog_DBG(TAG, "%s: closing shared serverfd %d", __FUNCTION__, baseSocket->serverfd);
ArrayList_Remove(g_NamedPipeServerSockets, baseSocket);
close(baseSocket->serverfd);
free(baseSocket->name);
@ -211,7 +211,7 @@ HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD
if (!strcmp(baseSocket->name, lpName))
{
serverfd = baseSocket->serverfd;
//WLog_DBG(TAG, "using shared socked resource for pipe %p (%s)\n", pNamedPipe, lpName);
//WLog_DBG(TAG, "using shared socked resource for pipe %p (%s)", pNamedPipe, lpName);
break;
}
}
@ -238,7 +238,7 @@ HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD
if ((serverfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
{
WLog_ERR(TAG, "CreateNamedPipeA: socket error, %s\n", strerror(errno));
WLog_ERR(TAG, "CreateNamedPipeA: socket error, %s", strerror(errno));
goto out;
}
@ -248,13 +248,13 @@ HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD
if (bind(serverfd, (struct sockaddr *) &s, sizeof(struct sockaddr_un)) == -1)
{
WLog_ERR(TAG, "CreateNamedPipeA: bind error, %s\n", strerror(errno));
WLog_ERR(TAG, "CreateNamedPipeA: bind error, %s", strerror(errno));
goto out;
}
if (listen(serverfd, 2) == -1)
{
WLog_ERR(TAG, "CreateNamedPipeA: listen error, %s\n", strerror(errno));
WLog_ERR(TAG, "CreateNamedPipeA: listen error, %s", strerror(errno));
goto out;
}
@ -272,11 +272,11 @@ HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD
baseSocket->serverfd = serverfd;
baseSocket->references = 0;
ArrayList_Add(g_NamedPipeServerSockets, baseSocket);
//WLog_DBG(TAG, "created shared socked resource for pipe %p (%s). base serverfd = %d\n", pNamedPipe, lpName, serverfd);
//WLog_DBG(TAG, "created shared socked resource for pipe %p (%s). base serverfd = %d", pNamedPipe, lpName, serverfd);
}
pNamedPipe->serverfd = dup(baseSocket->serverfd);
//WLog_DBG(TAG, "using serverfd %d (duplicated from %d)\n", pNamedPipe->serverfd, baseSocket->serverfd);
//WLog_DBG(TAG, "using serverfd %d (duplicated from %d)", pNamedPipe->serverfd, baseSocket->serverfd);
pNamedPipe->pfnUnrefNamedPipe = winpr_unref_named_pipe;
baseSocket->references++;
@ -338,7 +338,7 @@ BOOL ConnectNamedPipe(HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped)
if (status < 0)
{
WLog_ERR(TAG, "ConnectNamedPipe: accept error\n");
WLog_ERR(TAG, "ConnectNamedPipe: accept error");
return FALSE;
}
@ -381,12 +381,14 @@ BOOL DisconnectNamedPipe(HANDLE hNamedPipe)
BOOL PeekNamedPipe(HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize,
LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail, LPDWORD lpBytesLeftThisMessage)
{
WLog_ERR(TAG, "Not implemented");
return TRUE;
}
BOOL TransactNamedPipe(HANDLE hNamedPipe, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer,
DWORD nOutBufferSize, LPDWORD lpBytesRead, LPOVERLAPPED lpOverlapped)
{
WLog_ERR(TAG, "Not implemented");
return TRUE;
}
@ -427,6 +429,7 @@ BOOL WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut)
BOOL WaitNamedPipeW(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
{
WLog_ERR(TAG, "Not implemented");
return TRUE;
}
@ -468,16 +471,19 @@ BOOL SetNamedPipeHandleState(HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCol
BOOL ImpersonateNamedPipeClient(HANDLE hNamedPipe)
{
WLog_ERR(TAG, "Not implemented");
return FALSE;
}
BOOL GetNamedPipeClientComputerNameA(HANDLE Pipe, LPCSTR ClientComputerName, ULONG ClientComputerNameLength)
{
WLog_ERR(TAG, "Not implemented");
return FALSE;
}
BOOL GetNamedPipeClientComputerNameW(HANDLE Pipe, LPCWSTR ClientComputerName, ULONG ClientComputerNameLength)
{
WLog_ERR(TAG, "Not implemented");
return FALSE;
}

View File

@ -26,7 +26,7 @@
#include "pool.h"
#include "../log.h"
#define TAG "pool"
#define TAG WINPR_TAG("pool")
#ifdef _WIN32
@ -34,11 +34,11 @@ static BOOL module_initialized = FALSE;
static BOOL module_available = FALSE;
static HMODULE kernel32_module = NULL;
static PTP_WORK (WINAPI * pCreateThreadpoolWork)(PTP_WORK_CALLBACK pfnwk, PVOID pv, PTP_CALLBACK_ENVIRON pcbe);
static VOID (WINAPI * pCloseThreadpoolWork)(PTP_WORK pwk);
static VOID (WINAPI * pSubmitThreadpoolWork)(PTP_WORK pwk);
static BOOL (WINAPI * pTrySubmitThreadpoolCallback)(PTP_SIMPLE_CALLBACK pfns, PVOID pv, PTP_CALLBACK_ENVIRON pcbe);
static VOID (WINAPI * pWaitForThreadpoolWorkCallbacks)(PTP_WORK pwk, BOOL fCancelPendingCallbacks);
static PTP_WORK(WINAPI *pCreateThreadpoolWork)(PTP_WORK_CALLBACK pfnwk, PVOID pv, PTP_CALLBACK_ENVIRON pcbe);
static VOID (WINAPI *pCloseThreadpoolWork)(PTP_WORK pwk);
static VOID (WINAPI *pSubmitThreadpoolWork)(PTP_WORK pwk);
static BOOL (WINAPI *pTrySubmitThreadpoolCallback)(PTP_SIMPLE_CALLBACK pfns, PVOID pv, PTP_CALLBACK_ENVIRON pcbe);
static VOID (WINAPI *pWaitForThreadpoolWorkCallbacks)(PTP_WORK pwk, BOOL fCancelPendingCallbacks);
static void module_init()
{
@ -52,12 +52,11 @@ static void module_init()
return;
module_available = TRUE;
pCreateThreadpoolWork = (void*) GetProcAddress(kernel32_module, "CreateThreadpoolWork");
pCloseThreadpoolWork = (void*) GetProcAddress(kernel32_module, "CloseThreadpoolWork");
pSubmitThreadpoolWork = (void*) GetProcAddress(kernel32_module, "SubmitThreadpoolWork");
pTrySubmitThreadpoolCallback = (void*) GetProcAddress(kernel32_module, "TrySubmitThreadpoolCallback");
pWaitForThreadpoolWorkCallbacks = (void*) GetProcAddress(kernel32_module, "WaitForThreadpoolWorkCallbacks");
pCreateThreadpoolWork = (void *) GetProcAddress(kernel32_module, "CreateThreadpoolWork");
pCloseThreadpoolWork = (void *) GetProcAddress(kernel32_module, "CloseThreadpoolWork");
pSubmitThreadpoolWork = (void *) GetProcAddress(kernel32_module, "SubmitThreadpoolWork");
pTrySubmitThreadpoolCallback = (void *) GetProcAddress(kernel32_module, "TrySubmitThreadpoolCallback");
pWaitForThreadpoolWorkCallbacks = (void *) GetProcAddress(kernel32_module, "WaitForThreadpoolWorkCallbacks");
}
#endif
@ -67,12 +66,12 @@ static void module_init()
PTP_WORK CreateThreadpoolWork(PTP_WORK_CALLBACK pfnwk, PVOID pv, PTP_CALLBACK_ENVIRON pcbe)
{
PTP_WORK work = NULL;
#ifdef _WIN32
module_init();
if (pCreateThreadpoolWork)
return pCreateThreadpoolWork(pfnwk, pv, pcbe);
#else
work = (PTP_WORK) malloc(sizeof(TP_WORK));
@ -86,8 +85,8 @@ PTP_WORK CreateThreadpoolWork(PTP_WORK_CALLBACK pfnwk, PVOID pv, PTP_CALLBACK_EN
work->CallbackEnvironment = pcbe;
}
#endif
#endif
return work;
}
@ -98,6 +97,7 @@ VOID CloseThreadpoolWork(PTP_WORK pwk)
if (pCloseThreadpoolWork)
pCloseThreadpoolWork(pwk);
#else
free(pwk);
#endif
@ -110,12 +110,11 @@ VOID SubmitThreadpoolWork(PTP_WORK pwk)
if (pSubmitThreadpoolWork)
pSubmitThreadpoolWork(pwk);
#else
PTP_POOL pool;
PTP_CALLBACK_INSTANCE callbackInstance;
pool = pwk->CallbackEnvironment->Pool;
callbackInstance = (PTP_CALLBACK_INSTANCE) malloc(sizeof(TP_CALLBACK_INSTANCE));
if (callbackInstance)
@ -124,6 +123,7 @@ VOID SubmitThreadpoolWork(PTP_WORK pwk)
CountdownEvent_AddCount(pool->WorkComplete, 1);
Queue_Enqueue(pool->PendingQueue, callbackInstance);
}
#endif
}
@ -134,6 +134,7 @@ BOOL TrySubmitThreadpoolCallback(PTP_SIMPLE_CALLBACK pfns, PVOID pv, PTP_CALLBAC
if (pTrySubmitThreadpoolCallback)
return pTrySubmitThreadpoolCallback(pfns, pv, pcbe);
#else
#endif
return FALSE;
@ -146,15 +147,16 @@ VOID WaitForThreadpoolWorkCallbacks(PTP_WORK pwk, BOOL fCancelPendingCallbacks)
if (pWaitForThreadpoolWorkCallbacks)
pWaitForThreadpoolWorkCallbacks(pwk, fCancelPendingCallbacks);
#else
HANDLE event;
PTP_POOL pool;
pool = pwk->CallbackEnvironment->Pool;
event = CountdownEvent_WaitHandle(pool->WorkComplete);
if (WaitForSingleObject(event, INFINITE) != WAIT_OBJECT_0)
WLog_ERR(TAG, "error waiting on work completion");
#endif
}

View File

@ -30,7 +30,7 @@
#include "registry_reg.h"
#include "../log.h"
#define TAG "registry"
#define TAG WINPR_TAG("registry")
#define WINPR_HKLM_HIVE "/etc/winpr/HKLM.reg"
@ -163,7 +163,7 @@ static RegVal *reg_load_value(Reg *reg, RegKey *key)
}
else
{
WLog_ERR(TAG, "unimplemented format: %s\n", REG_DATA_TYPE_STRINGS[value->type]);
WLog_ERR(TAG, "unimplemented format: %s", REG_DATA_TYPE_STRINGS[value->type]);
}
if (!key->values)
@ -315,7 +315,7 @@ static void reg_unload_value(Reg *reg, RegVal *value)
}
else
{
WLog_ERR(TAG, "unimplemented format: %s\n", REG_DATA_TYPE_STRINGS[value->type]);
WLog_ERR(TAG, "unimplemented format: %s", REG_DATA_TYPE_STRINGS[value->type]);
}
free(value);
@ -408,15 +408,15 @@ void reg_print_value(Reg *reg, RegVal *value)
if (value->type == REG_DWORD)
{
WLog_INFO(TAG, "dword:%08X\n", (int) value->data.dword);
WLog_INFO(TAG, "dword:%08X", (int) value->data.dword);
}
else if (value->type == REG_SZ)
{
WLog_INFO(TAG, "%s\"\n", value->data.string);
WLog_INFO(TAG, "%s\"", value->data.string);
}
else
{
WLog_ERR(TAG, "unimplemented format: %s\n", REG_DATA_TYPE_STRINGS[value->type]);
WLog_ERR(TAG, "unimplemented format: %s", REG_DATA_TYPE_STRINGS[value->type]);
}
}
@ -424,7 +424,7 @@ void reg_print_key(Reg *reg, RegKey *key)
{
RegVal *pValue;
pValue = key->values;
WLog_INFO(TAG, "[%s]\n", key->name);
WLog_INFO(TAG, "[%s]", key->name);
while (pValue != NULL)
{

View File

@ -40,7 +40,7 @@
#include "ndr_private.h"
#include "../log.h"
#define TAG "rpc"
#define TAG WINPR_TAG("rpc")
/**
* MSRPC NDR Types Technical Overview:
@ -319,6 +319,7 @@ CLIENT_CALL_RETURN NdrClientCall(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING
case 1:
*(float *) &stackTop[i] = *(float *) &fpuStack[i];
break;
case 2:
*(double *) &stackTop[i] = *(double *) &fpuStack[i];
break;

View File

@ -27,12 +27,10 @@
#include <winpr/rpc.h>
#include "ndr_array.h"
#include "ndr_private.h"
#ifndef _WIN32
#include "../log.h"
#define TAG "rpc"
void NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
{
/**

View File

@ -32,7 +32,7 @@
#include "ndr_private.h"
#include "../log.h"
#define TAG "rpc"
#define TAG WINPR_TAG("rpc")
void NdrContextHandleBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
{

View File

@ -31,9 +31,6 @@
#include "ndr_correlation.h"
#include "ndr_private.h"
#include "../log.h"
#define TAG "rpc"
/*
* Correlation Descriptors: http://msdn.microsoft.com/en-us/library/windows/desktop/aa373607/
*
@ -89,18 +86,23 @@ PFORMAT_STRING NdrpComputeCount(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMem
case FC_DEREFERENCE:
ptr = *(LPVOID *)((char *) ptr + offset);
break;
case FC_DIV_2:
ptr = (char *) ptr + offset;
break;
case FC_MULT_2:
ptr = (char *) ptr + offset;
break;
case FC_SUB_1:
ptr = (char *) ptr + offset;
break;
case FC_ADD_1:
ptr = (char *) ptr + offset;
break;
case FC_CALLBACK:
{
WLog_ERR(TAG, "warning: NdrpComputeConformance FC_CALLBACK unimplemented\n");
@ -116,23 +118,29 @@ PFORMAT_STRING NdrpComputeCount(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMem
case FC_LONG:
data = *(LONG *) ptr;
break;
case FC_ULONG:
data = *(ULONG *) ptr;
break;
case FC_SHORT:
data = *(SHORT *) ptr;
break;
case FC_USHORT:
data = *(USHORT *) ptr;
break;
case FC_CHAR:
case FC_SMALL:
data = *(CHAR *) ptr;
break;
case FC_BYTE:
case FC_USMALL:
data = *(BYTE *) ptr;
break;
case FC_HYPER:
data = (ULONG_PTR) *(ULONGLONG *) ptr;
break;
@ -144,18 +152,23 @@ PFORMAT_STRING NdrpComputeCount(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMem
case FC_DEREFERENCE:
*pCount = data;
break;
case FC_DIV_2:
*pCount = data / 1;
break;
case FC_MULT_2:
*pCount = data * 1;
break;
case FC_SUB_1:
*pCount = data - 1;
break;
case FC_ADD_1:
*pCount = data + 1;
break;
case FC_CALLBACK:
break;
}

View File

@ -31,9 +31,6 @@
#include "ndr_pointer.h"
#include "ndr_private.h"
#include "../log.h"
#define TAG "rpc"
/**
* Pointer Layout: http://msdn.microsoft.com/en-us/library/windows/desktop/aa374376/
*
@ -142,13 +139,14 @@ void NdrpPointerBufferSize(unsigned char *pMemory, PFORMAT_STRING pFormat, PMIDL
{
case FC_RP: /* Reference Pointer */
break;
case FC_UP: /* Unique Pointer */
case FC_OP: /* Unique Pointer in an object interface */
if (!pMemory)
return;
break;
case FC_FP: /* Full Pointer */
WLog_ERR(TAG, "warning: FC_FP unimplemented");
break;
@ -195,7 +193,7 @@ PFORMAT_STRING NdrpEmbeddedRepeatPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
if (pFormat[1] == FC_VARIABLE_OFFSET)
{
pMemory += pStubMsg->Offset * *((unsigned short *) &pFormat[1]);
pMemory += pStubMsg->Offset **((unsigned short *) &pFormat[1]);
}
}

View File

@ -22,10 +22,13 @@
#include <winpr/rpc.h>
#include "../log.h"
#define TAG WINPR_TAG("rpc")
#ifndef _WIN32
void NdrpAlignLength(ULONG* length, unsigned int alignment);
void NdrpIncrementLength(ULONG* length, unsigned int size);
void NdrpAlignLength(ULONG *length, unsigned int alignment);
void NdrpIncrementLength(ULONG *length, unsigned int size);
extern const NDR_TYPE_SIZE_ROUTINE pfnSizeRoutines[];
extern const NDR_TYPE_MARSHALL_ROUTINE pfnMarshallRoutines[];
@ -37,7 +40,7 @@ extern const char SimpleTypeBufferSize[];
extern const char SimpleTypeMemorySize[];
extern const char NdrTypeFlags[];
extern const char* FC_TYPE_STRINGS[];
extern const char *FC_TYPE_STRINGS[];
#include "ndr_correlation.h"

View File

@ -29,9 +29,7 @@
#ifndef _WIN32
#include "ndr_string.h"
#include "../log.h"
#define TAG "rpc"
#include "ndr_private.h"
void NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
{

View File

@ -32,9 +32,6 @@
#include "ndr_pointer.h"
#include "ndr_structure.h"
#include "../log.h"
#define TAG "rpc"
/* Structures: http://msdn.microsoft.com/en-us/library/windows/desktop/aa378695/ */
void NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
@ -116,35 +113,44 @@ ULONG NdrComplexStructMemberSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFo
case FC_USMALL:
size += sizeof(BYTE);
break;
case FC_WCHAR:
case FC_SHORT:
case FC_USHORT:
case FC_ENUM16:
size += sizeof(USHORT);
break;
case FC_LONG:
case FC_ULONG:
case FC_ENUM32:
size += sizeof(ULONG);
break;
case FC_INT3264:
case FC_UINT3264:
size += sizeof(INT_PTR);
break;
case FC_FLOAT:
size += sizeof(FLOAT);
break;
case FC_DOUBLE:
size += sizeof(DOUBLE);
break;
case FC_HYPER:
size += sizeof(ULONGLONG);
break;
case FC_ERROR_STATUS_T:
size += sizeof(error_status_t);
break;
case FC_IGNORE:
break;
case FC_RP:
case FC_UP:
case FC_OP:
@ -156,15 +162,19 @@ ULONG NdrComplexStructMemberSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFo
pFormat += 4;
break;
case FC_ALIGNM2:
NdrpAlignLength(&size, 2);
break;
case FC_ALIGNM4:
NdrpAlignLength(&size, 4);
break;
case FC_ALIGNM8:
NdrpAlignLength(&size, 8);
break;
case FC_STRUCTPAD1:
case FC_STRUCTPAD2:
case FC_STRUCTPAD3:
@ -174,11 +184,14 @@ ULONG NdrComplexStructMemberSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFo
case FC_STRUCTPAD7:
size += *pFormat - FC_STRUCTPAD1 + 1;
break;
case FC_PAD:
break;
case FC_EMBEDDED_COMPLEX:
WLog_ERR(TAG, "warning: NdrComplexStructMemberSize FC_EMBEDDED_COMPLEX unimplemented");
break;
default:
WLog_ERR(TAG, "warning: NdrComplexStructMemberSize 0x%02X unimplemented", *pFormat);
break;

View File

@ -29,9 +29,7 @@
#ifndef _WIN32
#include "ndr_union.h"
#include "../log.h"
#define TAG "rpc"
#include "ndr_private.h"
void NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
{

View File

@ -31,462 +31,550 @@
#include <openssl/rand.h>
#include "../log.h"
#define TAG "rpc"
#define TAG WINPR_TAG("rpc")
RPC_STATUS RpcBindingCopy(RPC_BINDING_HANDLE SourceBinding, RPC_BINDING_HANDLE *DestinationBinding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingFree(RPC_BINDING_HANDLE *Binding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingSetOption(RPC_BINDING_HANDLE hBinding, unsigned long option, ULONG_PTR optionValue)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingInqOption(RPC_BINDING_HANDLE hBinding, unsigned long option, ULONG_PTR *pOptionValue)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingFromStringBindingA(RPC_CSTR StringBinding, RPC_BINDING_HANDLE *Binding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcSsGetContextBinding(void *ContextHandle, RPC_BINDING_HANDLE *Binding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingInqObject(RPC_BINDING_HANDLE Binding, UUID *ObjectUuid)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingReset(RPC_BINDING_HANDLE Binding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingSetObject(RPC_BINDING_HANDLE Binding, UUID *ObjectUuid)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtInqDefaultProtectLevel(unsigned long AuthnSvc, unsigned long *AuthnLevel)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingToStringBindingA(RPC_BINDING_HANDLE Binding, RPC_CSTR *StringBinding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingToStringBindingW(RPC_BINDING_HANDLE Binding, RPC_WSTR *StringBinding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingVectorFree(RPC_BINDING_VECTOR **BindingVector)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcStringBindingComposeA(RPC_CSTR ObjUuid, RPC_CSTR Protseq, RPC_CSTR NetworkAddr,
RPC_CSTR Endpoint, RPC_CSTR Options, RPC_CSTR *StringBinding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr,
RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcStringBindingParseA(RPC_CSTR StringBinding, RPC_CSTR *ObjUuid, RPC_CSTR *Protseq,
RPC_CSTR *NetworkAddr, RPC_CSTR *Endpoint, RPC_CSTR *NetworkOptions)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcStringBindingParseW(RPC_WSTR StringBinding, RPC_WSTR *ObjUuid, RPC_WSTR *Protseq,
RPC_WSTR *NetworkAddr, RPC_WSTR *Endpoint, RPC_WSTR *NetworkOptions)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcStringFreeA(RPC_CSTR *String)
{
WLog_ERR(TAG, "Not implemented");
free(String);
return RPC_S_OK;
}
RPC_STATUS RpcStringFreeW(RPC_WSTR *String)
{
WLog_ERR(TAG, "Not implemented");
free(String);
return RPC_S_OK;
}
RPC_STATUS RpcIfInqId(RPC_IF_HANDLE RpcIfHandle, RPC_IF_ID *RpcIfId)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcNetworkIsProtseqValidA(RPC_CSTR Protseq)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcNetworkIsProtseqValidW(RPC_WSTR Protseq)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtInqComTimeout(RPC_BINDING_HANDLE Binding, unsigned int *Timeout)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtSetComTimeout(RPC_BINDING_HANDLE Binding, unsigned int Timeout)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtSetCancelTimeout(long Timeout)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcNetworkInqProtseqsA(RPC_PROTSEQ_VECTORA **ProtseqVector)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcNetworkInqProtseqsW(RPC_PROTSEQ_VECTORW **ProtseqVector)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcObjectInqType(UUID *ObjUuid, UUID *TypeUuid)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcObjectSetInqFn(RPC_OBJECT_INQ_FN *InquiryFn)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcObjectSetType(UUID *ObjUuid, UUID *TypeUuid)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcProtseqVectorFreeA(RPC_PROTSEQ_VECTORA **ProtseqVector)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcProtseqVectorFreeW(RPC_PROTSEQ_VECTORW **ProtseqVector)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerInqBindings(RPC_BINDING_VECTOR **BindingVector)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerInqIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV **MgrEpv)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerListen(unsigned int MinimumCallThreads, unsigned int MaxCalls, unsigned int DontWait)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerRegisterIfEx(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv,
unsigned int Flags, unsigned int MaxCalls, RPC_IF_CALLBACK_FN *IfCallback)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerRegisterIf2(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv,
unsigned int Flags, unsigned int MaxCalls, unsigned int MaxRpcSize, RPC_IF_CALLBACK_FN *IfCallbackFn)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, unsigned int WaitForCallsToComplete)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUnregisterIfEx(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, int RundownContextHandles)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseAllProtseqs(unsigned int MaxCalls, void *SecurityDescriptor)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseAllProtseqsEx(unsigned int MaxCalls, void *SecurityDescriptor, PRPC_POLICY Policy)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseAllProtseqsIf(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseAllProtseqsIfEx(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor, PRPC_POLICY Policy)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqExA(RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor, PRPC_POLICY Policy)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqExW(RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor, PRPC_POLICY Policy)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqEpA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_CSTR Endpoint, void *SecurityDescriptor)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqEpExA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_CSTR Endpoint, void *SecurityDescriptor, PRPC_POLICY Policy)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqEpW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_WSTR Endpoint, void *SecurityDescriptor)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqEpExW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_WSTR Endpoint, void *SecurityDescriptor, PRPC_POLICY Policy)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqIfA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqIfExA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor, PRPC_POLICY Policy)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqIfW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerUseProtseqIfExW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor, PRPC_POLICY Policy)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
void RpcServerYield()
{
WLog_ERR(TAG, "Not implemented");
}
RPC_STATUS RpcMgmtStatsVectorFree(RPC_STATS_VECTOR **StatsVector)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtInqStats(RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR **Statistics)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtIsServerListening(RPC_BINDING_HANDLE Binding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtWaitServerListen(void)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtSetServerStackSize(unsigned long ThreadStackSize)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
void RpcSsDontSerializeContext(void)
{
WLog_ERR(TAG, "Not implemented");
}
RPC_STATUS RpcMgmtEnableIdleCleanup(void)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtInqIfIds(RPC_BINDING_HANDLE Binding, RPC_IF_ID_VECTOR **IfIdVector)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcIfIdVectorFree(RPC_IF_ID_VECTOR **IfIdVector)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtInqServerPrincNameA(RPC_BINDING_HANDLE Binding, unsigned long AuthnSvc, RPC_CSTR *ServerPrincName)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtInqServerPrincNameW(RPC_BINDING_HANDLE Binding, unsigned long AuthnSvc, RPC_WSTR *ServerPrincName)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerInqDefaultPrincNameA(unsigned long AuthnSvc, RPC_CSTR *PrincName)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerInqDefaultPrincNameW(unsigned long AuthnSvc, RPC_WSTR *PrincName)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcEpResolveBinding(RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE IfSpec)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcNsBindingInqEntryNameA(RPC_BINDING_HANDLE Binding, unsigned long EntryNameSyntax, RPC_CSTR *EntryName)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcNsBindingInqEntryNameW(RPC_BINDING_HANDLE Binding, unsigned long EntryNameSyntax, RPC_WSTR *EntryName)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcRevertToSelfEx(RPC_BINDING_HANDLE BindingHandle)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcRevertToSelf()
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingInqAuthClientA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs,
RPC_CSTR *ServerPrincName, unsigned long *AuthnLevel, unsigned long *AuthnSvc, unsigned long *AuthzSvc)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingInqAuthClientW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs,
RPC_WSTR *ServerPrincName, unsigned long *AuthnLevel, unsigned long *AuthnSvc, unsigned long *AuthzSvc)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingInqAuthClientExA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs,
RPC_CSTR *ServerPrincName, unsigned long *AuthnLevel, unsigned long *AuthnSvc, unsigned long *AuthzSvc, unsigned long Flags)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingInqAuthClientExW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs,
RPC_WSTR *ServerPrincName, unsigned long *AuthnLevel, unsigned long *AuthnSvc, unsigned long *AuthzSvc, unsigned long Flags)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingInqAuthInfoA(RPC_BINDING_HANDLE Binding, RPC_CSTR *ServerPrincName, unsigned long *AuthnLevel,
unsigned long *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, unsigned long *AuthzSvc)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingInqAuthInfoW(RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName, unsigned long *AuthnLevel,
unsigned long *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, unsigned long *AuthzSvc)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingSetAuthInfoA(RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingSetAuthInfoExA(RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc, RPC_SECURITY_QOS *SecurityQos)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingSetAuthInfoW(RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingSetAuthInfoExW(RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc, RPC_SECURITY_QOS *SecurityQOS)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
@ -494,6 +582,7 @@ RPC_STATUS RpcBindingInqAuthInfoExA(RPC_BINDING_HANDLE Binding, RPC_CSTR *Server
unsigned long *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, unsigned long *AuthzSvc,
unsigned long RpcQosVersion, RPC_SECURITY_QOS *SecurityQOS)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
@ -501,23 +590,27 @@ RPC_STATUS RpcBindingInqAuthInfoExW(RPC_BINDING_HANDLE Binding, RPC_WSTR *Server
unsigned long *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, unsigned long *AuthzSvc,
unsigned long RpcQosVersion, RPC_SECURITY_QOS *SecurityQOS)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerRegisterAuthInfoA(RPC_CSTR ServerPrincName, unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void *Arg)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerRegisterAuthInfoW(RPC_WSTR ServerPrincName, unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void *Arg)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding, RPC_BINDING_HANDLE *ServerBinding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
@ -529,21 +622,25 @@ void RpcRaiseException(RPC_STATUS exception)
RPC_STATUS RpcTestCancel()
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerTestCancel(RPC_BINDING_HANDLE BindingHandle)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcCancelThread(void *Thread)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcCancelThreadEx(void *Thread, long Timeout)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
@ -593,6 +690,7 @@ RPC_STATUS UuidToStringA(UUID *Uuid, RPC_CSTR *StringUuid)
RPC_STATUS UuidToStringW(UUID *Uuid, RPC_WSTR *StringUuid)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
@ -645,6 +743,7 @@ RPC_STATUS UuidFromStringA(RPC_CSTR StringUuid, UUID *Uuid)
RPC_STATUS UuidFromStringW(RPC_WSTR StringUuid, UUID *Uuid)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
@ -690,6 +789,7 @@ int UuidEqual(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
unsigned short UuidHash(UUID *Uuid, RPC_STATUS *Status)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
@ -700,37 +800,44 @@ int UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
RPC_STATUS RpcEpRegisterNoReplaceA(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector, RPC_CSTR Annotation)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcEpRegisterNoReplaceW(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector, RPC_WSTR Annotation)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcEpRegisterA(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector, RPC_CSTR Annotation)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcEpRegisterW(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector, RPC_WSTR Annotation)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcEpUnregister(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS DceErrorInqTextA(RPC_STATUS RpcStatus, RPC_CSTR ErrorText)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS DceErrorInqTextW(RPC_STATUS RpcStatus, RPC_WSTR ErrorText)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
@ -738,40 +845,47 @@ RPC_STATUS DceErrorInqTextW(RPC_STATUS RpcStatus, RPC_WSTR ErrorText)
RPC_STATUS RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE EpBinding, unsigned long InquiryType, RPC_IF_ID *IfId,
unsigned long VersOption, UUID *ObjectUuid, RPC_EP_INQ_HANDLE *InquiryContext)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtEpEltInqDone(RPC_EP_INQ_HANDLE *InquiryContext)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtEpEltInqNextA(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID *IfId,
RPC_BINDING_HANDLE *Binding, UUID *ObjectUuid, RPC_CSTR *Annotation)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtEpEltInqNextW(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID *IfId,
RPC_BINDING_HANDLE *Binding, UUID *ObjectUuid, RPC_WSTR *Annotation)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtEpUnregister(RPC_BINDING_HANDLE EpBinding, RPC_IF_ID *IfId,
RPC_BINDING_HANDLE Binding, UUID *ObjectUuid)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcMgmtSetAuthorizationFn(RPC_MGMT_AUTHORIZATION_FN AuthorizationFn)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}
RPC_STATUS RpcServerInqBindingHandle(RPC_BINDING_HANDLE *Binding)
{
WLog_ERR(TAG, "Not implemented");
return 0;
}

View File

@ -38,7 +38,7 @@
#include "smartcard_pcsc.h"
#include "../log.h"
#define TAG "smartcard"
#define TAG WINPR_TAG("smartcard")
/**
* PC/SC transactions:
@ -347,7 +347,7 @@ void PCSC_ReleaseCardContext(SCARDCONTEXT hContext)
if (!pContext)
{
WLog_ERR(TAG, "PCSC_ReleaseCardContext: null pContext!\n");
WLog_ERR(TAG, "PCSC_ReleaseCardContext: null pContext!");
return;
}
@ -367,7 +367,7 @@ BOOL PCSC_LockCardContext(SCARDCONTEXT hContext)
if (!pContext)
{
WLog_ERR(TAG, "PCSC_LockCardContext: invalid context (%p)\n", (void *) hContext);
WLog_ERR(TAG, "PCSC_LockCardContext: invalid context (%p)", (void *) hContext);
return FALSE;
}
@ -382,7 +382,7 @@ BOOL PCSC_UnlockCardContext(SCARDCONTEXT hContext)
if (!pContext)
{
WLog_ERR(TAG, "PCSC_UnlockCardContext: invalid context (%p)\n", (void *) hContext);
WLog_ERR(TAG, "PCSC_UnlockCardContext: invalid context (%p)", (void *) hContext);
return FALSE;
}
@ -424,7 +424,7 @@ PCSC_SCARDHANDLE *PCSC_ConnectCardHandle(SCARDCONTEXT hSharedContext, SCARDCONTE
if (!pContext)
{
WLog_ERR(TAG, "PCSC_ConnectCardHandle: null pContext!\n");
WLog_ERR(TAG, "PCSC_ConnectCardHandle: null pContext!");
return NULL;
}
@ -480,7 +480,7 @@ BOOL PCSC_LockCardHandle(SCARDHANDLE hCard)
if (!pCard)
{
WLog_ERR(TAG, "PCSC_LockCardHandle: invalid handle (%p)\n", (void *) hCard);
WLog_ERR(TAG, "PCSC_LockCardHandle: invalid handle (%p)", (void *) hCard);
return FALSE;
}
@ -495,7 +495,7 @@ BOOL PCSC_UnlockCardHandle(SCARDHANDLE hCard)
if (!pCard)
{
WLog_ERR(TAG, "PCSC_UnlockCardHandle: invalid handle (%p)\n", (void *) hCard);
WLog_ERR(TAG, "PCSC_UnlockCardHandle: invalid handle (%p)", (void *) hCard);
return FALSE;
}
@ -511,7 +511,7 @@ BOOL PCSC_LockCardTransaction(SCARDHANDLE hCard)
if (!pCard)
{
WLog_ERR(TAG, "PCSC_LockCardTransaction: invalid handle (%p)\n", (void *) hCard);
WLog_ERR(TAG, "PCSC_LockCardTransaction: invalid handle (%p)", (void *) hCard);
return FALSE;
}
@ -527,7 +527,7 @@ BOOL PCSC_UnlockCardTransaction(SCARDHANDLE hCard)
if (!pCard)
{
WLog_ERR(TAG, "PCSC_UnlockCardTransaction: invalid handle (%p)\n", (void *) hCard);
WLog_ERR(TAG, "PCSC_UnlockCardTransaction: invalid handle (%p)", (void *) hCard);
return FALSE;
}
@ -727,7 +727,7 @@ char *PCSC_ConvertReaderNameToWinSCard(const char *name)
*/
index = 0;
sprintf_s(nameWinSCard, size, "%.*s %d", length, p, index);
//printf("Smart Card Reader Name Alias: %s -> %s\n", p, nameWinSCard);
//printf("Smart Card Reader Name Alias: %s -> %s", p, nameWinSCard);
return nameWinSCard;
}
@ -893,7 +893,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardReleaseContext_Internal(SCARDCONTEXT hContext)
if (!hContext)
{
WLog_ERR(TAG, "SCardReleaseContext: null hContext\n");
WLog_ERR(TAG, "SCardReleaseContext: null hContext");
return status;
}

View File

@ -40,7 +40,7 @@
#include "ntlm_message.h"
#include "../../log.h"
#define TAG "sspi.NTLM"
#define TAG WINPR_TAG("sspi.NTLM")
char *NTLM_PACKAGE_NAME = "NTLM";
@ -935,7 +935,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_DecryptMessage(PCtxtHandle phContext, PSecBufferD
if (memcmp(signature_buffer->pvBuffer, expected_signature, 16) != 0)
{
/* signature verification failed! */
WLog_ERR(TAG, "signature verification failed, something nasty is going on!\n");
WLog_ERR(TAG, "signature verification failed, something nasty is going on!");
WLog_ERR(TAG, "Expected Signature:");
winpr_HexDump(TAG, WLOG_ERROR, expected_signature, 16);
WLog_ERR(TAG, "Actual Signature:");

View File

@ -33,7 +33,7 @@
#include "ntlm_av_pairs.h"
#include "../../log.h"
#define TAG "sspi.NTLM"
#define TAG WINPR_TAG("sspi.NTLM")
const char *const AV_PAIR_STRINGS[] =
{

View File

@ -33,7 +33,7 @@
#include "ntlm_compute.h"
#include "../../log.h"
#define TAG "sspi.NTLM"
#define TAG WINPR_TAG("sspi.NTLM")
const char LM_MAGIC[] = "KGS!@#$%";

View File

@ -34,7 +34,7 @@
#include "ntlm_message.h"
#include "../log.h"
#define TAG "sspi.NTLM"
#define TAG WINPR_TAG("sspi.NTLM")
static const char NTLM_SIGNATURE[8] = { 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0' };

View File

@ -29,7 +29,7 @@
#include "schannel_openssl.h"
#include "../../log.h"
#define TAG "sspi.schannel"
#define TAG WINPR_TAG("sspi.schannel")
char *openssl_get_ssl_error_string(int ssl_error)
{
@ -37,12 +37,16 @@ char *openssl_get_ssl_error_string(int ssl_error)
{
case SSL_ERROR_ZERO_RETURN:
return "SSL_ERROR_ZERO_RETURN";
case SSL_ERROR_WANT_READ:
return "SSL_ERROR_WANT_READ";
case SSL_ERROR_WANT_WRITE:
return "SSL_ERROR_WANT_WRITE";
case SSL_ERROR_SYSCALL:
return "SSL_ERROR_SYSCALL";
case SSL_ERROR_SSL:
ERR_print_errors_fp(stdout);
return "SSL_ERROR_SSL";
@ -59,7 +63,7 @@ int schannel_openssl_client_init(SCHANNEL_OPENSSL *context)
if (!context->ctx)
{
WLog_ERR(TAG, "SSL_CTX_new failed\n");
WLog_ERR(TAG, "SSL_CTX_new failed");
return -1;
}
@ -94,7 +98,7 @@ int schannel_openssl_client_init(SCHANNEL_OPENSSL *context)
if (!context->ssl)
{
WLog_ERR(TAG, "SSL_new failed\n");
WLog_ERR(TAG, "SSL_new failed");
return -1;
}
@ -102,7 +106,7 @@ int schannel_openssl_client_init(SCHANNEL_OPENSSL *context)
if (!context->bioRead)
{
WLog_ERR(TAG, "BIO_new failed\n");
WLog_ERR(TAG, "BIO_new failed");
return -1;
}
@ -111,7 +115,7 @@ int schannel_openssl_client_init(SCHANNEL_OPENSSL *context)
if (!context->bioWrite)
{
WLog_ERR(TAG, "BIO_new failed\n");
WLog_ERR(TAG, "BIO_new failed");
return -1;
}
@ -132,7 +136,7 @@ int schannel_openssl_server_init(SCHANNEL_OPENSSL *context)
if (!context->ctx)
{
WLog_ERR(TAG, "SSL_CTX_new failed\n");
WLog_ERR(TAG, "SSL_CTX_new failed");
return -1;
}
@ -173,7 +177,7 @@ int schannel_openssl_server_init(SCHANNEL_OPENSSL *context)
if (SSL_CTX_use_RSAPrivateKey_file(context->ctx, "/tmp/localhost.key", SSL_FILETYPE_PEM) <= 0)
{
WLog_ERR(TAG, "SSL_CTX_use_RSAPrivateKey_file failed\n");
WLog_ERR(TAG, "SSL_CTX_use_RSAPrivateKey_file failed");
return -1;
}
@ -181,13 +185,13 @@ int schannel_openssl_server_init(SCHANNEL_OPENSSL *context)
if (!context->ssl)
{
WLog_ERR(TAG, "SSL_new failed\n");
WLog_ERR(TAG, "SSL_new failed");
return -1;
}
if (SSL_use_certificate_file(context->ssl, "/tmp/localhost.crt", SSL_FILETYPE_PEM) <= 0)
{
WLog_ERR(TAG, "SSL_use_certificate_file failed\n");
WLog_ERR(TAG, "SSL_use_certificate_file failed");
return -1;
}
@ -195,7 +199,7 @@ int schannel_openssl_server_init(SCHANNEL_OPENSSL *context)
if (!context->bioRead)
{
WLog_ERR(TAG, "BIO_new failed\n");
WLog_ERR(TAG, "BIO_new failed");
return -1;
}
@ -204,7 +208,7 @@ int schannel_openssl_server_init(SCHANNEL_OPENSSL *context)
if (!context->bioWrite)
{
WLog_ERR(TAG, "BIO_new failed\n");
WLog_ERR(TAG, "BIO_new failed");
return -1;
}
@ -242,7 +246,7 @@ SECURITY_STATUS schannel_openssl_client_process_tokens(SCHANNEL_OPENSSL *context
if (status < 0)
{
ssl_error = SSL_get_error(context->ssl, status);
WLog_ERR(TAG, "SSL_connect error: %s\n", openssl_get_ssl_error_string(ssl_error));
WLog_ERR(TAG, "SSL_connect error: %s", openssl_get_ssl_error_string(ssl_error));
}
if (status == 1)
@ -299,7 +303,7 @@ SECURITY_STATUS schannel_openssl_server_process_tokens(SCHANNEL_OPENSSL *context
if (status < 0)
{
ssl_error = SSL_get_error(context->ssl, status);
WLog_ERR(TAG, "SSL_accept error: %s\n", openssl_get_ssl_error_string(ssl_error));
WLog_ERR(TAG, "SSL_accept error: %s", openssl_get_ssl_error_string(ssl_error));
}
if (status == 1)
@ -355,7 +359,7 @@ SECURITY_STATUS schannel_openssl_encrypt_message(SCHANNEL_OPENSSL *context, PSec
if (status < 0)
{
ssl_error = SSL_get_error(context->ssl, status);
WLog_ERR(TAG, "SSL_write: %s\n", openssl_get_ssl_error_string(ssl_error));
WLog_ERR(TAG, "SSL_write: %s", openssl_get_ssl_error_string(ssl_error));
}
status = BIO_read(context->bioWrite, context->ReadBuffer, SCHANNEL_CB_MAX_TOKEN);
@ -397,7 +401,7 @@ SECURITY_STATUS schannel_openssl_decrypt_message(SCHANNEL_OPENSSL *context, PSec
if (status < 0)
{
ssl_error = SSL_get_error(context->ssl, status);
WLog_ERR(TAG, "SSL_read: %s\n", openssl_get_ssl_error_string(ssl_error));
WLog_ERR(TAG, "SSL_read: %s", openssl_get_ssl_error_string(ssl_error));
}
length = status;

View File

@ -37,7 +37,7 @@
#ifndef _WIN32
#include "../log.h"
#define TAG "synch.critical"
#define TAG WINPR_TAG("synch.critical")
VOID InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
{

View File

@ -44,7 +44,7 @@
#include "../pipe/pipe.h"
#include "../log.h"
#define TAG "synch.event"
#define TAG WINPR_TAG("synch.event")
CRITICAL_SECTION cs = { NULL, 0, 0, NULL, NULL, 0 };

View File

@ -27,7 +27,7 @@
#include <winpr/interlocked.h>
#include "../log.h"
#define TAG "com.winpr.sync"
#define TAG WINPR_TAG("sync")
#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
@ -57,6 +57,7 @@ BOOL InitOnceExecuteOnce(PINIT_ONCE InitOnce, PINIT_ONCE_FN InitFn, PVOID Parame
case 2:
/* already completed successfully */
return TRUE;
case 0:
/* first time */
@ -77,9 +78,11 @@ BOOL InitOnceExecuteOnce(PINIT_ONCE InitOnce, PINIT_ONCE_FN InitFn, PVOID Parame
/* the init function returned an error, reset the status */
InitOnce->Ptr = (PVOID)0;
return FALSE;
case 1:
/* in progress */
break;
default:
WLog_ERR(TAG, "internal error");
return FALSE;

View File

@ -33,7 +33,7 @@
#include "../handle/handle.h"
#include "../log.h"
#define TAG "synch.semaphore"
#define TAG WINPR_TAG("synch.semaphore")
HANDLE CreateSemaphoreW(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName)
{

View File

@ -40,7 +40,7 @@
#include "../handle/handle.h"
#include "../log.h"
#define TAG "synch.timer"
#define TAG WINPR_TAG("synch.timer")
#ifdef WITH_POSIX_TIMER
@ -258,7 +258,7 @@ BOOL SetWaitableTimer(HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPerio
if (status)
{
WLog_ERR(TAG, "timerfd_settime failure: %d\n", status);
WLog_ERR(TAG, "timerfd_settime failure: %d", status);
return FALSE;
}

View File

@ -50,7 +50,7 @@
#include <winpr/thread.h>
#include "../log.h"
#define TAG "winpr.sync.wait"
#define TAG WINPR_TAG("sync.wait")
/**
* WaitForSingleObject

View File

@ -69,7 +69,7 @@ defined(__OpenBSD__) || defined(__DragonFly__)
#endif
#include "../log.h"
#define TAG "sysinfo"
#define TAG WINPR_TAG("sysinfo")
static DWORD GetProcessorArchitecture()
{
@ -194,7 +194,6 @@ BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD l
case ComputerNamePhysicalDnsHostname:
case ComputerNamePhysicalDnsDomain:
case ComputerNamePhysicalDnsFullyQualified:
if (*lpnSize <= length)
{
*lpnSize = length + 1;
@ -207,6 +206,7 @@ BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD l
CopyMemory(lpBuffer, hostname, length);
lpBuffer[length] = '\0';
break;
default:
return FALSE;
}
@ -216,7 +216,7 @@ BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD l
BOOL GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize)
{
WLog_ERR(TAG, "GetComputerNameExW unimplemented\n");
WLog_ERR(TAG, "GetComputerNameExW unimplemented");
return 0;
}
@ -254,7 +254,7 @@ BOOL GetVersionExA(LPOSVERSIONINFOA lpVersionInformation)
BOOL GetVersionExW(LPOSVERSIONINFOW lpVersionInformation)
{
WLog_ERR(TAG, "GetVersionExW unimplemented\n");
WLog_ERR(TAG, "GetVersionExW unimplemented");
return 1;
}
@ -528,68 +528,65 @@ BOOL IsProcessorFeaturePresent(DWORD ProcessorFeature)
{
case PF_ARM_NEON_INSTRUCTIONS_AVAILABLE:
case PF_ARM_NEON:
if (caps & HWCAP_NEON)
ret = TRUE;
break;
case PF_ARM_THUMB:
case PF_ARM_THUMB:
if (caps & HWCAP_THUMB)
ret = TRUE;
case PF_ARM_VFP_32_REGISTERS_AVAILABLE:
if (caps & HWCAP_VFPD32)
ret = TRUE;
case PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE:
if ((caps & HWCAP_IDIVA) || (caps & HWCAP_IDIVT))
ret = TRUE;
case PF_ARM_VFP3:
if (caps & HWCAP_VFPv3)
ret = TRUE;
break;
case PF_ARM_JAZELLE:
case PF_ARM_JAZELLE:
if (caps & HWCAP_JAVA)
ret = TRUE;
break;
case PF_ARM_DSP:
if (caps & HWCAP_EDSP)
ret = TRUE;
break;
case PF_ARM_MPU:
if (caps & HWCAP_EDSP)
ret = TRUE;
break;
case PF_ARM_THUMB2:
case PF_ARM_THUMB2:
if ((caps & HWCAP_IDIVT) || (caps & HWCAP_VFPv4))
ret = TRUE;
break;
case PF_ARM_T2EE:
case PF_ARM_T2EE:
if (caps & HWCAP_THUMBEE)
ret = TRUE;
break;
case PF_ARM_INTEL_WMMX:
case PF_ARM_INTEL_WMMX:
if (caps & HWCAP_IWMMXT)
ret = TRUE;
break;
default:
break;
}
@ -613,35 +610,35 @@ BOOL IsProcessorFeaturePresent(DWORD ProcessorFeature)
switch (ProcessorFeature)
{
case PF_MMX_INSTRUCTIONS_AVAILABLE:
if (d & D_BIT_MMX)
ret = TRUE;
break;
case PF_XMMI_INSTRUCTIONS_AVAILABLE:
case PF_XMMI_INSTRUCTIONS_AVAILABLE:
if (d & D_BIT_SSE)
ret = TRUE;
break;
case PF_XMMI64_INSTRUCTIONS_AVAILABLE:
case PF_XMMI64_INSTRUCTIONS_AVAILABLE:
if (d & D_BIT_SSE2)
ret = TRUE;
break;
case PF_3DNOW_INSTRUCTIONS_AVAILABLE:
case PF_3DNOW_INSTRUCTIONS_AVAILABLE:
if (d & D_BIT_3DN)
ret = TRUE;
break;
case PF_SSE3_INSTRUCTIONS_AVAILABLE:
case PF_SSE3_INSTRUCTIONS_AVAILABLE:
if (c & C_BIT_SSE3)
ret = TRUE;
break;
default:
break;
}
@ -664,31 +661,30 @@ BOOL IsProcessorFeaturePresentEx(DWORD ProcessorFeature)
switch (ProcessorFeature)
{
case PF_EX_ARM_VFP1:
if (caps & HWCAP_VFP)
ret = TRUE;
break;
case PF_EX_ARM_VFP3D16:
case PF_EX_ARM_VFP3D16:
if (caps & HWCAP_VFPv3D16)
ret = TRUE;
break;
case PF_EX_ARM_VFP4:
case PF_EX_ARM_VFP4:
if (caps & HWCAP_VFPv4)
ret = TRUE;
break;
case PF_EX_ARM_IDIVA:
case PF_EX_ARM_IDIVA:
if (caps & HWCAP_IDIVA)
ret = TRUE;
break;
case PF_EX_ARM_IDIVT:
case PF_EX_ARM_IDIVT:
if (caps & HWCAP_IDIVT)
ret = TRUE;
@ -703,36 +699,36 @@ BOOL IsProcessorFeaturePresentEx(DWORD ProcessorFeature)
switch (ProcessorFeature)
{
case PF_EX_LZCNT:
if (c & C_BIT_LZCNT)
ret = TRUE;
break;
case PF_EX_3DNOW_PREFETCH:
case PF_EX_3DNOW_PREFETCH:
if (c & C_BIT_3DNP)
ret = TRUE;
break;
case PF_EX_SSSE3:
case PF_EX_SSSE3:
if (c & C_BIT_SSSE3)
ret = TRUE;
break;
case PF_EX_SSE41:
case PF_EX_SSE41:
if (c & C_BIT_SSE41)
ret = TRUE;
break;
case PF_EX_SSE42:
case PF_EX_SSE42:
if (c & C_BIT_SSE42)
ret = TRUE;
break;
#if defined(__GNUC__) && defined(__AVX__)
case PF_EX_AVX:
case PF_EX_FMA:
case PF_EX_AVX_AES:
@ -753,20 +749,20 @@ BOOL IsProcessorFeaturePresentEx(DWORD ProcessorFeature)
case PF_EX_AVX:
ret = TRUE;
break;
case PF_EX_FMA:
case PF_EX_FMA:
if (c & C_BIT_FMA)
ret = TRUE;
break;
case PF_EX_AVX_AES:
case PF_EX_AVX_AES:
if (c & C_BIT_AES)
ret = TRUE;
break;
case PF_EX_AVX_PCLMULQDQ:
case PF_EX_AVX_PCLMULQDQ:
if (c & C_BIT_PCLMULQDQ)
ret = TRUE;
@ -776,6 +772,7 @@ BOOL IsProcessorFeaturePresentEx(DWORD ProcessorFeature)
}
break;
#endif //__AVX__
default:
break;
}

View File

@ -32,7 +32,7 @@
#endif
#include "../log.h"
#define TAG "thread"
#define TAG WINPR_TAG("thread")
/**
* CommandLineToArgvW function:
@ -88,22 +88,22 @@
*
*/
LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
LPSTR *CommandLineToArgvA(LPCSTR lpCmdLine, int *pNumArgs)
{
char* p;
char *p;
int index;
int length;
char* pBeg;
char* pEnd;
char* buffer;
char* pOutput;
char *pBeg;
char *pEnd;
char *buffer;
char *pOutput;
int numArgs;
LPSTR* pArgs;
LPSTR *pArgs;
int maxNumArgs;
int maxBufferSize;
int currentIndex;
int cmdLineLength;
BOOL* lpEscapedChars;
BOOL *lpEscapedChars;
LPSTR lpEscapedCmdLine;
if (!lpCmdLine)
@ -114,23 +114,19 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
pArgs = NULL;
numArgs = 0;
lpEscapedCmdLine = NULL;
cmdLineLength = strlen(lpCmdLine);
lpEscapedChars = (BOOL*) malloc((cmdLineLength + 1) * sizeof(BOOL));
lpEscapedChars = (BOOL *) malloc((cmdLineLength + 1) * sizeof(BOOL));
ZeroMemory(lpEscapedChars, (cmdLineLength + 1) * sizeof(BOOL));
if (strstr(lpCmdLine, "\\\""))
{
int i, n;
char* pLastEnd = NULL;
lpEscapedCmdLine = (char*) malloc((cmdLineLength + 1) * sizeof(char));
p = (char*) lpCmdLine;
pLastEnd = (char*) lpCmdLine;
pOutput = (char*) lpEscapedCmdLine;
char *pLastEnd = NULL;
lpEscapedCmdLine = (char *) malloc((cmdLineLength + 1) * sizeof(char));
p = (char *) lpCmdLine;
pLastEnd = (char *) lpCmdLine;
pOutput = (char *) lpEscapedCmdLine;
while (p < &lpCmdLine[cmdLineLength])
{
@ -142,7 +138,6 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
CopyMemory(pOutput, p, length);
pOutput += length;
p += length;
break;
}
@ -160,7 +155,6 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
}
n = (pEnd - pBeg) - 1;
length = (pBeg - pLastEnd);
CopyMemory(pOutput, p, length);
pOutput += length;
@ -179,44 +173,38 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
*pOutput = '"';
pOutput++;
pLastEnd = p;
}
*pOutput = '\0';
pOutput++;
lpCmdLine = (LPCSTR) lpEscapedCmdLine;
cmdLineLength = strlen(lpCmdLine);
}
maxNumArgs = 2;
currentIndex = 0;
p = (char*) lpCmdLine;
p = (char *) lpCmdLine;
while (currentIndex < cmdLineLength - 1)
{
index = strcspn(p, " \t");
currentIndex += (index + 1);
p = (char*) &lpCmdLine[currentIndex];
p = (char *) &lpCmdLine[currentIndex];
maxNumArgs++;
}
maxBufferSize = (maxNumArgs * (sizeof(char*))) + (cmdLineLength + 1);
buffer = (char*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, maxBufferSize);
maxBufferSize = (maxNumArgs * (sizeof(char *))) + (cmdLineLength + 1);
buffer = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, maxBufferSize);
if (!buffer)
return NULL;
pArgs = (LPSTR*) buffer;
pOutput = (char*) &buffer[maxNumArgs * (sizeof(char*))];
pArgs = (LPSTR *) buffer;
pOutput = (char *) &buffer[maxNumArgs * (sizeof(char *))];
numArgs = 0;
currentIndex = 0;
p = (char*) lpCmdLine;
p = (char *) lpCmdLine;
while (currentIndex < cmdLineLength)
{
@ -238,12 +226,9 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
if (p[index] != '"')
{
/* no whitespace escaped with double quotes */
p = &p[index + 1];
pEnd = p - 1;
length = (pEnd - pBeg);
CopyMemory(pOutput, pBeg, length);
pOutput[length] = '\0';
pArgs[numArgs++] = pOutput;
@ -316,13 +301,12 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
free(lpEscapedChars);
*pNumArgs = numArgs;
return pArgs;
}
#ifndef _WIN32
LPWSTR* CommandLineToArgvW(LPCWSTR lpCmdLine, int* pNumArgs)
LPWSTR *CommandLineToArgvW(LPCWSTR lpCmdLine, int *pNumArgs)
{
return NULL;
}

View File

@ -27,7 +27,7 @@
#include <openssl/err.h>
#include "../log.h"
#define TAG "utils.ssl"
#define TAG WINPR_TAG("utils.ssl")
static int g_winpr_openssl_num_locks = 0;
static HANDLE *g_winpr_openssl_locks = NULL;

View File

@ -26,7 +26,7 @@
#include "wlog/DataMessage.h"
#include "../../log.h"
#define TAG "utils.wlog"
#define TAG WINPR_TAG("utils.wlog")
int WLog_DataMessage_Write(char *filename, void *data, int length)
{
@ -35,7 +35,7 @@ int WLog_DataMessage_Write(char *filename, void *data, int length)
if (!fp)
{
WLog_ERR(TAG, "failed to open file %s\n", filename);
WLog_ERR(TAG, "failed to open file %s", filename);
return -1;
}

View File

@ -28,10 +28,16 @@
#include <winpr/print.h>
#include <winpr/environment.h>
#if defined(ANDROID)
#include <android/log.h>
#endif
#include <winpr/wlog.h>
#include "wlog/wlog.h"
#include "../../log.h"
/**
* References for general logging concepts:
*
@ -60,8 +66,7 @@ static void log_recursion(const char *file, const char *fkt, int line)
{
/* TODO: Stack trace here! */
#if defined(ANDROID)
const char *tag = "com.winpr.utils.wlog";
level = ANDROID_LOG_FATAL;
const char *tag = WINPR_TAG("utils.wlog");
__android_log_print(ANDROID_LOG_FATAL, tag, "Recursion detected!!!");
__android_log_print(ANDROID_LOG_FATAL, tag, "Check %s [%s:%d]", fkt, file, line);
#else

View File

@ -33,7 +33,7 @@
#include "wtsapi.h"
#include "../log.h"
#define TAG "wtsapi"
#define TAG WINPR_TAG("wtsapi")
/**
* Remote Desktop Services API Functions:
@ -611,14 +611,14 @@ void InitializeWtsApiStubs_FreeRDS()
if (IniFile_Parse(ini, "/var/run/freerds.instance") < 0)
{
IniFile_Free(ini);
WLog_ERR(TAG, "failed to parse freerds.instance\n");
WLog_ERR(TAG, "failed to parse freerds.instance");
LoadAndInitialize(FREERDS_LIBRARY_NAME);
return;
}
prefix = IniFile_GetKeyValueString(ini, "FreeRDS", "prefix");
libdir = IniFile_GetKeyValueString(ini, "FreeRDS", "libdir");
WLog_INFO(TAG, "FreeRDS (prefix / libdir): %s / %s\n", prefix, libdir);
WLog_INFO(TAG, "FreeRDS (prefix / libdir): %s / %s", prefix, libdir);
if (prefix && libdir)
{