Merge pull request #789 from FreeRDP/channels

CMake Improvements + .rdp file support
This commit is contained in:
Marc-André Moreau 2012-10-29 06:53:20 -07:00
commit 9a9e871a37
104 changed files with 3241 additions and 1715 deletions

4
.gitignore vendored
View File

@ -28,6 +28,10 @@ _CPack_Packages
*.cproject
*.settings
# .rdp files
*.rdp
*.RDP
# Documentation
docs/api
client/X11/xfreerdp.1

View File

@ -63,9 +63,12 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
# Default to build shared libs
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
if(ANDROID)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
endif()
endif()
if(NOT DEFINED EXPORT_ALL_SYMBOLS)
@ -182,9 +185,8 @@ endif()
if(NOT WIN32)
find_required_package(ZLIB)
find_optional_package(PulseAudio)
find_optional_package(MacAudio)
find_optional_package(PCSC)
find_optional_package(PulseAudio)
if(NOT ANDROID)
find_suggested_package(Cups)
@ -198,7 +200,7 @@ if(NOT WIN32)
endif()
endif()
if(NOT ANDROID)
if((NOT ANDROID) AND (NOT APPLE))
find_suggested_package(FFmpeg)
endif()
endif()

View File

@ -1,215 +0,0 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Forward declare test functions. */
int TestAsn1Module(int, char*[]);
int TestAsn1Encoder(int, char*[]);
int TestAsn1Decoder(int, char*[]);
int TestAsn1Encode(int, char*[]);
int TestAsn1Decode(int, char*[]);
int TestAsn1String(int, char*[]);
int TestAsn1Integer(int, char*[]);
int TestAsn1Compare(int, char*[]);
int TestAsn1BerEnc(int, char*[]);
int TestAsn1BerDec(int, char*[]);
int TestAsn1DerEnc(int, char*[]);
int TestAsn1DerDec(int, char*[]);
/* Create map. */
typedef int (*MainFuncPointer)(int , char*[]);
typedef struct
{
const char* name;
MainFuncPointer func;
} functionMapEntry;
functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
{
"TestAsn1Module",
TestAsn1Module
},
{
"TestAsn1Encoder",
TestAsn1Encoder
},
{
"TestAsn1Decoder",
TestAsn1Decoder
},
{
"TestAsn1Encode",
TestAsn1Encode
},
{
"TestAsn1Decode",
TestAsn1Decode
},
{
"TestAsn1String",
TestAsn1String
},
{
"TestAsn1Integer",
TestAsn1Integer
},
{
"TestAsn1Compare",
TestAsn1Compare
},
{
"TestAsn1BerEnc",
TestAsn1BerEnc
},
{
"TestAsn1BerDec",
TestAsn1BerDec
},
{
"TestAsn1DerEnc",
TestAsn1DerEnc
},
{
"TestAsn1DerDec",
TestAsn1DerDec
},
{0,0}
};
/* Allocate and create a lowercased copy of string
(note that it has to be free'd manually) */
char* lowercase(const char *string)
{
char *new_string, *p;
#ifdef __cplusplus
new_string = static_cast<char *>(malloc(sizeof(char) *
static_cast<size_t>(strlen(string) + 1)));
#else
new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1)));
#endif
if (!new_string)
{
return 0;
}
strcpy(new_string, string);
p = new_string;
while (*p != 0)
{
#ifdef __cplusplus
*p = static_cast<char>(tolower(*p));
#else
*p = (char)(tolower(*p));
#endif
++p;
}
return new_string;
}
int main(int ac, char *av[])
{
int i, NumTests, testNum, partial_match;
char *arg, *test_name;
int count;
int testToRun = -1;
for(count =0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++)
{
}
NumTests = count;
/* If no test name was given */
/* process command line with user function. */
if (ac < 2)
{
/* Ask for a test. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("To run a test, enter the test number: ");
fflush(stdout);
testNum = 0;
if( scanf("%d", &testNum) != 1 )
{
printf("Couldn't parse that input as a number\n");
return -1;
}
if (testNum >= NumTests)
{
printf("%3d is an invalid test number.\n", testNum);
return -1;
}
testToRun = testNum;
ac--;
av++;
}
partial_match = 0;
arg = 0;
/* If partial match is requested. */
if(testToRun == -1 && ac > 1)
{
partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
}
if (partial_match && ac < 3)
{
printf("-R needs an additional parameter.\n");
return -1;
}
if(testToRun == -1)
{
arg = lowercase(av[1 + partial_match]);
}
for (i =0; i < NumTests && testToRun == -1; ++i)
{
test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
if (partial_match && strstr(test_name, arg) != NULL)
{
testToRun = i;
ac -=2;
av += 2;
}
else if (!partial_match && strcmp(test_name, arg) == 0)
{
testToRun = i;
ac--;
av++;
}
free(test_name);
}
if(arg)
{
free(arg);
}
if(testToRun != -1)
{
int result;
result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av);
return result;
}
/* Nothing was run, display the test names. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("Failed: %s is an invalid test name.\n", av[1]);
return -1;
}

View File

@ -1,160 +0,0 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Forward declare test functions. */
int TestAlignment(int, char*[]);
/* Create map. */
typedef int (*MainFuncPointer)(int , char*[]);
typedef struct
{
const char* name;
MainFuncPointer func;
} functionMapEntry;
functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
{
"TestAlignment",
TestAlignment
},
{0,0}
};
/* Allocate and create a lowercased copy of string
(note that it has to be free'd manually) */
char* lowercase(const char *string)
{
char *new_string, *p;
#ifdef __cplusplus
new_string = static_cast<char *>(malloc(sizeof(char) *
static_cast<size_t>(strlen(string) + 1)));
#else
new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1)));
#endif
if (!new_string)
{
return 0;
}
strcpy(new_string, string);
p = new_string;
while (*p != 0)
{
#ifdef __cplusplus
*p = static_cast<char>(tolower(*p));
#else
*p = (char)(tolower(*p));
#endif
++p;
}
return new_string;
}
int main(int ac, char *av[])
{
int i, NumTests, testNum, partial_match;
char *arg, *test_name;
int count;
int testToRun = -1;
for(count =0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++)
{
}
NumTests = count;
/* If no test name was given */
/* process command line with user function. */
if (ac < 2)
{
/* Ask for a test. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("To run a test, enter the test number: ");
fflush(stdout);
testNum = 0;
if( scanf("%d", &testNum) != 1 )
{
printf("Couldn't parse that input as a number\n");
return -1;
}
if (testNum >= NumTests)
{
printf("%3d is an invalid test number.\n", testNum);
return -1;
}
testToRun = testNum;
ac--;
av++;
}
partial_match = 0;
arg = 0;
/* If partial match is requested. */
if(testToRun == -1 && ac > 1)
{
partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
}
if (partial_match && ac < 3)
{
printf("-R needs an additional parameter.\n");
return -1;
}
if(testToRun == -1)
{
arg = lowercase(av[1 + partial_match]);
}
for (i =0; i < NumTests && testToRun == -1; ++i)
{
test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
if (partial_match && strstr(test_name, arg) != NULL)
{
testToRun = i;
ac -=2;
av += 2;
}
else if (!partial_match && strcmp(test_name, arg) == 0)
{
testToRun = i;
ac--;
av++;
}
free(test_name);
}
if(arg)
{
free(arg);
}
if(testToRun != -1)
{
int result;
result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av);
return result;
}
/* Nothing was run, display the test names. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("Failed: %s is an invalid test name.\n", av[1]);
return -1;
}

View File

@ -1,190 +0,0 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Forward declare test functions. */
int TestFileCreateFile(int, char*[]);
int TestFileDeleteFile(int, char*[]);
int TestFileReadFile(int, char*[]);
int TestFileWriteFile(int, char*[]);
int TestFileFindFirstFile(int, char*[]);
int TestFileFindFirstFileEx(int, char*[]);
int TestFileFindNextFile(int, char*[]);
/* Create map. */
typedef int (*MainFuncPointer)(int , char*[]);
typedef struct
{
const char* name;
MainFuncPointer func;
} functionMapEntry;
functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
{
"TestFileCreateFile",
TestFileCreateFile
},
{
"TestFileDeleteFile",
TestFileDeleteFile
},
{
"TestFileReadFile",
TestFileReadFile
},
{
"TestFileWriteFile",
TestFileWriteFile
},
{
"TestFileFindFirstFile",
TestFileFindFirstFile
},
{
"TestFileFindFirstFileEx",
TestFileFindFirstFileEx
},
{
"TestFileFindNextFile",
TestFileFindNextFile
},
{0,0}
};
/* Allocate and create a lowercased copy of string
(note that it has to be free'd manually) */
char* lowercase(const char *string)
{
char *new_string, *p;
#ifdef __cplusplus
new_string = static_cast<char *>(malloc(sizeof(char) *
static_cast<size_t>(strlen(string) + 1)));
#else
new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1)));
#endif
if (!new_string)
{
return 0;
}
strcpy(new_string, string);
p = new_string;
while (*p != 0)
{
#ifdef __cplusplus
*p = static_cast<char>(tolower(*p));
#else
*p = (char)(tolower(*p));
#endif
++p;
}
return new_string;
}
int main(int ac, char *av[])
{
int i, NumTests, testNum, partial_match;
char *arg, *test_name;
int count;
int testToRun = -1;
for(count =0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++)
{
}
NumTests = count;
/* If no test name was given */
/* process command line with user function. */
if (ac < 2)
{
/* Ask for a test. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("To run a test, enter the test number: ");
fflush(stdout);
testNum = 0;
if( scanf("%d", &testNum) != 1 )
{
printf("Couldn't parse that input as a number\n");
return -1;
}
if (testNum >= NumTests)
{
printf("%3d is an invalid test number.\n", testNum);
return -1;
}
testToRun = testNum;
ac--;
av++;
}
partial_match = 0;
arg = 0;
/* If partial match is requested. */
if(testToRun == -1 && ac > 1)
{
partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
}
if (partial_match && ac < 3)
{
printf("-R needs an additional parameter.\n");
return -1;
}
if(testToRun == -1)
{
arg = lowercase(av[1 + partial_match]);
}
for (i =0; i < NumTests && testToRun == -1; ++i)
{
test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
if (partial_match && strstr(test_name, arg) != NULL)
{
testToRun = i;
ac -=2;
av += 2;
}
else if (!partial_match && strcmp(test_name, arg) == 0)
{
testToRun = i;
ac--;
av++;
}
free(test_name);
}
if(arg)
{
free(arg);
}
if(testToRun != -1)
{
int result;
result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av);
return result;
}
/* Nothing was run, display the test names. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("Failed: %s is an invalid test name.\n", av[1]);
return -1;
}

View File

@ -1,170 +0,0 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Forward declare test functions. */
int TestInterlockedAccess(int, char*[]);
int TestInterlockedSList(int, char*[]);
int TestInterlockedDList(int, char*[]);
/* Create map. */
typedef int (*MainFuncPointer)(int , char*[]);
typedef struct
{
const char* name;
MainFuncPointer func;
} functionMapEntry;
functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
{
"TestInterlockedAccess",
TestInterlockedAccess
},
{
"TestInterlockedSList",
TestInterlockedSList
},
{
"TestInterlockedDList",
TestInterlockedDList
},
{0,0}
};
/* Allocate and create a lowercased copy of string
(note that it has to be free'd manually) */
char* lowercase(const char *string)
{
char *new_string, *p;
#ifdef __cplusplus
new_string = static_cast<char *>(malloc(sizeof(char) *
static_cast<size_t>(strlen(string) + 1)));
#else
new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1)));
#endif
if (!new_string)
{
return 0;
}
strcpy(new_string, string);
p = new_string;
while (*p != 0)
{
#ifdef __cplusplus
*p = static_cast<char>(tolower(*p));
#else
*p = (char)(tolower(*p));
#endif
++p;
}
return new_string;
}
int main(int ac, char *av[])
{
int i, NumTests, testNum, partial_match;
char *arg, *test_name;
int count;
int testToRun = -1;
for(count =0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++)
{
}
NumTests = count;
/* If no test name was given */
/* process command line with user function. */
if (ac < 2)
{
/* Ask for a test. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("To run a test, enter the test number: ");
fflush(stdout);
testNum = 0;
if( scanf("%d", &testNum) != 1 )
{
printf("Couldn't parse that input as a number\n");
return -1;
}
if (testNum >= NumTests)
{
printf("%3d is an invalid test number.\n", testNum);
return -1;
}
testToRun = testNum;
ac--;
av++;
}
partial_match = 0;
arg = 0;
/* If partial match is requested. */
if(testToRun == -1 && ac > 1)
{
partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
}
if (partial_match && ac < 3)
{
printf("-R needs an additional parameter.\n");
return -1;
}
if(testToRun == -1)
{
arg = lowercase(av[1 + partial_match]);
}
for (i =0; i < NumTests && testToRun == -1; ++i)
{
test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
if (partial_match && strstr(test_name, arg) != NULL)
{
testToRun = i;
ac -=2;
av += 2;
}
else if (!partial_match && strcmp(test_name, arg) == 0)
{
testToRun = i;
ac--;
av++;
}
free(test_name);
}
if(arg)
{
free(arg);
}
if(testToRun != -1)
{
int result;
result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av);
return result;
}
/* Nothing was run, display the test names. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("Failed: %s is an invalid test name.\n", av[1]);
return -1;
}

View File

@ -1,185 +0,0 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Forward declare test functions. */
int TestLibraryAddDllDirectory(int, char*[]);
int TestLibraryRemoveDllDirectory(int, char*[]);
int TestLibrarySetDefaultDllDirectories(int, char*[]);
int TestLibraryLoadLibrary(int, char*[]);
int TestLibraryFreeLibrary(int, char*[]);
int TestLibraryGetProcAddress(int, char*[]);
/* Create map. */
typedef int (*MainFuncPointer)(int , char*[]);
typedef struct
{
const char* name;
MainFuncPointer func;
} functionMapEntry;
functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
{
"TestLibraryAddDllDirectory",
TestLibraryAddDllDirectory
},
{
"TestLibraryRemoveDllDirectory",
TestLibraryRemoveDllDirectory
},
{
"TestLibrarySetDefaultDllDirectories",
TestLibrarySetDefaultDllDirectories
},
{
"TestLibraryLoadLibrary",
TestLibraryLoadLibrary
},
{
"TestLibraryFreeLibrary",
TestLibraryFreeLibrary
},
{
"TestLibraryGetProcAddress",
TestLibraryGetProcAddress
},
{0,0}
};
/* Allocate and create a lowercased copy of string
(note that it has to be free'd manually) */
char* lowercase(const char *string)
{
char *new_string, *p;
#ifdef __cplusplus
new_string = static_cast<char *>(malloc(sizeof(char) *
static_cast<size_t>(strlen(string) + 1)));
#else
new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1)));
#endif
if (!new_string)
{
return 0;
}
strcpy(new_string, string);
p = new_string;
while (*p != 0)
{
#ifdef __cplusplus
*p = static_cast<char>(tolower(*p));
#else
*p = (char)(tolower(*p));
#endif
++p;
}
return new_string;
}
int main(int ac, char *av[])
{
int i, NumTests, testNum, partial_match;
char *arg, *test_name;
int count;
int testToRun = -1;
for(count =0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++)
{
}
NumTests = count;
/* If no test name was given */
/* process command line with user function. */
if (ac < 2)
{
/* Ask for a test. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("To run a test, enter the test number: ");
fflush(stdout);
testNum = 0;
if( scanf("%d", &testNum) != 1 )
{
printf("Couldn't parse that input as a number\n");
return -1;
}
if (testNum >= NumTests)
{
printf("%3d is an invalid test number.\n", testNum);
return -1;
}
testToRun = testNum;
ac--;
av++;
}
partial_match = 0;
arg = 0;
/* If partial match is requested. */
if(testToRun == -1 && ac > 1)
{
partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
}
if (partial_match && ac < 3)
{
printf("-R needs an additional parameter.\n");
return -1;
}
if(testToRun == -1)
{
arg = lowercase(av[1 + partial_match]);
}
for (i =0; i < NumTests && testToRun == -1; ++i)
{
test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
if (partial_match && strstr(test_name, arg) != NULL)
{
testToRun = i;
ac -=2;
av += 2;
}
else if (!partial_match && strcmp(test_name, arg) == 0)
{
testToRun = i;
ac--;
av++;
}
free(test_name);
}
if(arg)
{
free(arg);
}
if(testToRun != -1)
{
int result;
result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av);
return result;
}
/* Nothing was run, display the test names. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("Failed: %s is an invalid test name.\n", av[1]);
return -1;
}

View File

@ -1,265 +0,0 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Forward declare test functions. */
int TestPathCchAddBackslash(int, char*[]);
int TestPathCchRemoveBackslash(int, char*[]);
int TestPathCchAddBackslashEx(int, char*[]);
int TestPathCchRemoveBackslashEx(int, char*[]);
int TestPathCchAddExtension(int, char*[]);
int TestPathCchAppend(int, char*[]);
int TestPathCchAppendEx(int, char*[]);
int TestPathCchCanonicalize(int, char*[]);
int TestPathCchCanonicalizeEx(int, char*[]);
int TestPathAllocCanonicalize(int, char*[]);
int TestPathCchCombine(int, char*[]);
int TestPathCchCombineEx(int, char*[]);
int TestPathAllocCombine(int, char*[]);
int TestPathCchFindExtension(int, char*[]);
int TestPathCchRenameExtension(int, char*[]);
int TestPathCchRemoveExtension(int, char*[]);
int TestPathCchIsRoot(int, char*[]);
int TestPathIsUNCEx(int, char*[]);
int TestPathCchSkipRoot(int, char*[]);
int TestPathCchStripToRoot(int, char*[]);
int TestPathCchStripPrefix(int, char*[]);
int TestPathCchRemoveFileSpec(int, char*[]);
/* Create map. */
typedef int (*MainFuncPointer)(int , char*[]);
typedef struct
{
const char* name;
MainFuncPointer func;
} functionMapEntry;
functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
{
"TestPathCchAddBackslash",
TestPathCchAddBackslash
},
{
"TestPathCchRemoveBackslash",
TestPathCchRemoveBackslash
},
{
"TestPathCchAddBackslashEx",
TestPathCchAddBackslashEx
},
{
"TestPathCchRemoveBackslashEx",
TestPathCchRemoveBackslashEx
},
{
"TestPathCchAddExtension",
TestPathCchAddExtension
},
{
"TestPathCchAppend",
TestPathCchAppend
},
{
"TestPathCchAppendEx",
TestPathCchAppendEx
},
{
"TestPathCchCanonicalize",
TestPathCchCanonicalize
},
{
"TestPathCchCanonicalizeEx",
TestPathCchCanonicalizeEx
},
{
"TestPathAllocCanonicalize",
TestPathAllocCanonicalize
},
{
"TestPathCchCombine",
TestPathCchCombine
},
{
"TestPathCchCombineEx",
TestPathCchCombineEx
},
{
"TestPathAllocCombine",
TestPathAllocCombine
},
{
"TestPathCchFindExtension",
TestPathCchFindExtension
},
{
"TestPathCchRenameExtension",
TestPathCchRenameExtension
},
{
"TestPathCchRemoveExtension",
TestPathCchRemoveExtension
},
{
"TestPathCchIsRoot",
TestPathCchIsRoot
},
{
"TestPathIsUNCEx",
TestPathIsUNCEx
},
{
"TestPathCchSkipRoot",
TestPathCchSkipRoot
},
{
"TestPathCchStripToRoot",
TestPathCchStripToRoot
},
{
"TestPathCchStripPrefix",
TestPathCchStripPrefix
},
{
"TestPathCchRemoveFileSpec",
TestPathCchRemoveFileSpec
},
{0,0}
};
/* Allocate and create a lowercased copy of string
(note that it has to be free'd manually) */
char* lowercase(const char *string)
{
char *new_string, *p;
#ifdef __cplusplus
new_string = static_cast<char *>(malloc(sizeof(char) *
static_cast<size_t>(strlen(string) + 1)));
#else
new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1)));
#endif
if (!new_string)
{
return 0;
}
strcpy(new_string, string);
p = new_string;
while (*p != 0)
{
#ifdef __cplusplus
*p = static_cast<char>(tolower(*p));
#else
*p = (char)(tolower(*p));
#endif
++p;
}
return new_string;
}
int main(int ac, char *av[])
{
int i, NumTests, testNum, partial_match;
char *arg, *test_name;
int count;
int testToRun = -1;
for(count =0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++)
{
}
NumTests = count;
/* If no test name was given */
/* process command line with user function. */
if (ac < 2)
{
/* Ask for a test. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("To run a test, enter the test number: ");
fflush(stdout);
testNum = 0;
if( scanf("%d", &testNum) != 1 )
{
printf("Couldn't parse that input as a number\n");
return -1;
}
if (testNum >= NumTests)
{
printf("%3d is an invalid test number.\n", testNum);
return -1;
}
testToRun = testNum;
ac--;
av++;
}
partial_match = 0;
arg = 0;
/* If partial match is requested. */
if(testToRun == -1 && ac > 1)
{
partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
}
if (partial_match && ac < 3)
{
printf("-R needs an additional parameter.\n");
return -1;
}
if(testToRun == -1)
{
arg = lowercase(av[1 + partial_match]);
}
for (i =0; i < NumTests && testToRun == -1; ++i)
{
test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
if (partial_match && strstr(test_name, arg) != NULL)
{
testToRun = i;
ac -=2;
av += 2;
}
else if (!partial_match && strcmp(test_name, arg) == 0)
{
testToRun = i;
ac--;
av++;
}
free(test_name);
}
if(arg)
{
free(arg);
}
if(testToRun != -1)
{
int result;
result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av);
return result;
}
/* Nothing was run, display the test names. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("Failed: %s is an invalid test name.\n", av[1]);
return -1;
}

View File

@ -1,160 +0,0 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Forward declare test functions. */
int TestPipeCreatePipe(int, char*[]);
/* Create map. */
typedef int (*MainFuncPointer)(int , char*[]);
typedef struct
{
const char* name;
MainFuncPointer func;
} functionMapEntry;
functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
{
"TestPipeCreatePipe",
TestPipeCreatePipe
},
{0,0}
};
/* Allocate and create a lowercased copy of string
(note that it has to be free'd manually) */
char* lowercase(const char *string)
{
char *new_string, *p;
#ifdef __cplusplus
new_string = static_cast<char *>(malloc(sizeof(char) *
static_cast<size_t>(strlen(string) + 1)));
#else
new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1)));
#endif
if (!new_string)
{
return 0;
}
strcpy(new_string, string);
p = new_string;
while (*p != 0)
{
#ifdef __cplusplus
*p = static_cast<char>(tolower(*p));
#else
*p = (char)(tolower(*p));
#endif
++p;
}
return new_string;
}
int main(int ac, char *av[])
{
int i, NumTests, testNum, partial_match;
char *arg, *test_name;
int count;
int testToRun = -1;
for(count =0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++)
{
}
NumTests = count;
/* If no test name was given */
/* process command line with user function. */
if (ac < 2)
{
/* Ask for a test. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("To run a test, enter the test number: ");
fflush(stdout);
testNum = 0;
if( scanf("%d", &testNum) != 1 )
{
printf("Couldn't parse that input as a number\n");
return -1;
}
if (testNum >= NumTests)
{
printf("%3d is an invalid test number.\n", testNum);
return -1;
}
testToRun = testNum;
ac--;
av++;
}
partial_match = 0;
arg = 0;
/* If partial match is requested. */
if(testToRun == -1 && ac > 1)
{
partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
}
if (partial_match && ac < 3)
{
printf("-R needs an additional parameter.\n");
return -1;
}
if(testToRun == -1)
{
arg = lowercase(av[1 + partial_match]);
}
for (i =0; i < NumTests && testToRun == -1; ++i)
{
test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
if (partial_match && strstr(test_name, arg) != NULL)
{
testToRun = i;
ac -=2;
av += 2;
}
else if (!partial_match && strcmp(test_name, arg) == 0)
{
testToRun = i;
ac--;
av++;
}
free(test_name);
}
if(arg)
{
free(arg);
}
if(testToRun != -1)
{
int result;
result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av);
return result;
}
/* Nothing was run, display the test names. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("Failed: %s is an invalid test name.\n", av[1]);
return -1;
}

View File

@ -1,175 +0,0 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Forward declare test functions. */
int TestQuerySecurityPackageInfo(int, char*[]);
int TestEnumerateSecurityPackages(int, char*[]);
int TestInitializeSecurityContext(int, char*[]);
int TestAcquireCredentialsHandle(int, char*[]);
/* Create map. */
typedef int (*MainFuncPointer)(int , char*[]);
typedef struct
{
const char* name;
MainFuncPointer func;
} functionMapEntry;
functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
{
"TestQuerySecurityPackageInfo",
TestQuerySecurityPackageInfo
},
{
"TestEnumerateSecurityPackages",
TestEnumerateSecurityPackages
},
{
"TestInitializeSecurityContext",
TestInitializeSecurityContext
},
{
"TestAcquireCredentialsHandle",
TestAcquireCredentialsHandle
},
{0,0}
};
/* Allocate and create a lowercased copy of string
(note that it has to be free'd manually) */
char* lowercase(const char *string)
{
char *new_string, *p;
#ifdef __cplusplus
new_string = static_cast<char *>(malloc(sizeof(char) *
static_cast<size_t>(strlen(string) + 1)));
#else
new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1)));
#endif
if (!new_string)
{
return 0;
}
strcpy(new_string, string);
p = new_string;
while (*p != 0)
{
#ifdef __cplusplus
*p = static_cast<char>(tolower(*p));
#else
*p = (char)(tolower(*p));
#endif
++p;
}
return new_string;
}
int main(int ac, char *av[])
{
int i, NumTests, testNum, partial_match;
char *arg, *test_name;
int count;
int testToRun = -1;
for(count =0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++)
{
}
NumTests = count;
/* If no test name was given */
/* process command line with user function. */
if (ac < 2)
{
/* Ask for a test. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("To run a test, enter the test number: ");
fflush(stdout);
testNum = 0;
if( scanf("%d", &testNum) != 1 )
{
printf("Couldn't parse that input as a number\n");
return -1;
}
if (testNum >= NumTests)
{
printf("%3d is an invalid test number.\n", testNum);
return -1;
}
testToRun = testNum;
ac--;
av++;
}
partial_match = 0;
arg = 0;
/* If partial match is requested. */
if(testToRun == -1 && ac > 1)
{
partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
}
if (partial_match && ac < 3)
{
printf("-R needs an additional parameter.\n");
return -1;
}
if(testToRun == -1)
{
arg = lowercase(av[1 + partial_match]);
}
for (i =0; i < NumTests && testToRun == -1; ++i)
{
test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
if (partial_match && strstr(test_name, arg) != NULL)
{
testToRun = i;
ac -=2;
av += 2;
}
else if (!partial_match && strcmp(test_name, arg) == 0)
{
testToRun = i;
ac--;
av++;
}
free(test_name);
}
if(arg)
{
free(arg);
}
if(testToRun != -1)
{
int result;
result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av);
return result;
}
/* Nothing was run, display the test names. */
printf("Available tests:\n");
for (i =0; i < NumTests; ++i)
{
printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name);
}
printf("Failed: %s is an invalid test name.\n", av[1]);
return -1;
}

View File

@ -18,6 +18,7 @@
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(CMakeParseArguments)
include(CMakeDependentOption)
macro(define_channel_options)
set(PREFIX "CHANNEL")
@ -38,8 +39,18 @@ macro(define_channel_client_options _channel_client_default)
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" CHANNEL_CLIENT_OPTION)
set(CHANNEL_CLIENT_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel client")
option(${CHANNEL_CLIENT_OPTION} "${CHANNEL_CLIENT_OPTION_DOC}" ${_channel_client_default})
cmake_dependent_option(${CHANNEL_CLIENT_OPTION} "${CHANNEL_CLIENT_OPTION_DOC}"
${_channel_client_default} "${CHANNEL_OPTION}" OFF)
endmacro(define_channel_client_options)
macro(define_channel_server_options _channel_server_default)
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_SERVER" CHANNEL_SERVER_OPTION)
set(CHANNEL_SERVER_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel server")
option(${CHANNEL_SERVER_OPTION} "${CHANNEL_SERVER_OPTION_DOC}" ${_channel_server_default})
cmake_dependent_option(${CHANNEL_SERVER_OPTION} "${CHANNEL_SERVER_OPTION_DOC}"
${_channel_server_default} "${CHANNEL_OPTION}" OFF)
endmacro(define_channel_server_options)
macro(define_channel _channel_name)
set(CHANNEL_NAME ${_channel_name})
set(MODULE_NAME ${CHANNEL_NAME})
@ -81,7 +92,7 @@ endmacro(define_channel_server_subsystem)
macro(add_channel_client _channel_prefix _channel_name)
add_subdirectory(client)
if(${_channel_prefix}_CLIENT_STATIC)
if(${${_channel_prefix}_CLIENT_STATIC})
set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${_channel_prefix} PARENT_SCOPE)
set(${_channel_prefix}_CLIENT_NAME ${${_channel_prefix}_CLIENT_NAME} PARENT_SCOPE)
set(${_channel_prefix}_CLIENT_CHANNEL ${${_channel_prefix}_CLIENT_CHANNEL} PARENT_SCOPE)
@ -92,7 +103,7 @@ endmacro(add_channel_client)
macro(add_channel_server _channel_prefix _channel_name)
add_subdirectory(server)
if(${_channel_prefix}_SERVER_STATIC)
if(${${_channel_prefix}_SERVER_STATIC})
set(CHANNEL_STATIC_SERVER_MODULES ${CHANNEL_STATIC_SERVER_MODULES} ${_channel_prefix} PARENT_SCOPE)
set(${_channel_prefix}_SERVER_NAME ${${_channel_prefix}_SERVER_NAME} PARENT_SCOPE)
set(${_channel_prefix}_SERVER_CHANNEL ${${_channel_prefix}_SERVER_CHANNEL} PARENT_SCOPE)
@ -103,11 +114,11 @@ endmacro(add_channel_server)
macro(add_channel_client_library _module_prefix _module_name _channel_name _plugin _entry)
if(_plugin AND MSVC AND (NOT STATIC_CHANNELS))
if(${_plugin} AND MSVC AND (NOT STATIC_CHANNELS))
set(${_module_prefix}_SRCS ${${_module_prefix}_SRCS} module.def)
endif()
if(_plugin AND (NOT STATIC_CHANNELS))
if(${_plugin} AND (NOT STATIC_CHANNELS))
add_library(${_module_name} ${${_module_prefix}_SRCS})
else()
set(${_module_prefix}_STATIC ON PARENT_SCOPE)
@ -121,11 +132,11 @@ endmacro(add_channel_client_library)
macro(add_channel_server_library _module_prefix _module_name _channel_name _plugin _entry)
if(_plugin AND MSVC AND (NOT STATIC_CHANNELS))
if(${_plugin} AND MSVC AND (NOT STATIC_CHANNELS))
set(${_module_prefix}_SRCS ${${_module_prefix}_SRCS} module.def)
endif()
if(_plugin AND (NOT STATIC_CHANNELS))
if(${_plugin} AND (NOT STATIC_CHANNELS))
add_library(${_module_name} ${${_module_prefix}_SRCS})
else()
set(${_module_prefix}_STATIC ON PARENT_SCOPE)
@ -146,7 +157,16 @@ foreach(FILEPATH ${FILEPATHS})
set(CHANNEL_OPTION)
include(${FILEPATH})
if(${CHANNEL_OPTION})
message(STATUS "Adding ${CHANNEL_TYPE} channel \"${CHANNEL_NAME}\": ${CHANNEL_DESCRIPTION}")
set(CHANNEL_MESSAGE "Adding ${CHANNEL_TYPE} channel")
if(${CHANNEL_CLIENT_OPTION})
set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE} client")
endif()
if(${CHANNEL_SERVER_OPTION})
set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE} server")
endif()
set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE} \"${CHANNEL_NAME}\"")
set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE}: ${CHANNEL_DESCRIPTION}")
message(STATUS "${CHANNEL_MESSAGE}")
add_subdirectory(${DIR})
endif()
endif()

View File

@ -1,8 +1,21 @@
set(OPTION_DEFAULT ON)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT ON)
if(ANDROID)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
endif()
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "audin" TYPE "dynamic"
DESCRIPTION "Audio Input Redirection Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEAI]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,8 +1,17 @@
set(OPTION_DEFAULT ON)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "cliprdr" TYPE "static"
DESCRIPTION "Clipboard Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPECLIP]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,8 +1,15 @@
set(OPTION_DEFAULT ON)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
if(ANDROID)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
endif()
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "disk" TYPE "device"
@ -10,3 +17,6 @@ define_channel_options(NAME "disk" TYPE "device"
SPECIFICATIONS "[MS-RDPEFS]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,8 +1,17 @@
set(OPTION_DEFAULT ON)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "drdynvc" TYPE "static"
DESCRIPTION "Dynamic Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEDYC]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,8 +1,20 @@
set(OPTION_DEFAULT ON)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
if(WIN32)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
endif()
if(ANDROID)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
endif()
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "parallel" TYPE "device"
@ -10,3 +22,6 @@ define_channel_options(NAME "parallel" TYPE "device"
SPECIFICATIONS "[MS-RDPESP]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,12 +1,21 @@
set(OPTION_DEFAULT ON)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
if(WIN32)
set(OPTION_DEFAULT ON)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
elseif(WITH_CUPS)
set(OPTION_DEFAULT ON)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
else()
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
endif()
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "printer" TYPE "device"
@ -14,3 +23,6 @@ define_channel_options(NAME "printer" TYPE "device"
SPECIFICATIONS "[MS-RDPEPC]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,8 +1,17 @@
set(OPTION_DEFAULT ON)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "rail" TYPE "static"
DESCRIPTION "Remote Programs Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPERP]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,8 +1,17 @@
set(OPTION_DEFAULT ON)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "rdpdr" TYPE "static"
DESCRIPTION "Device Redirection Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEFS] [MS-RDPEPC] [MS-RDPESC] [MS-RDPESP]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,8 +1,17 @@
set(OPTION_DEFAULT ON)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT ON)
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "rdpsnd" TYPE "static"
DESCRIPTION "Audio Output Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEA]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,7 +1,14 @@
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
if(WITH_SAMPLE)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
endif()
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
@ -10,3 +17,6 @@ define_channel_options(NAME "sample" TYPE "static"
SPECIFICATIONS ""
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,8 +1,20 @@
set(OPTION_DEFAULT ON)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
if(WIN32)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
endif()
if(ANDROID)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
endif()
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "serial" TYPE "device"
@ -10,3 +22,6 @@ define_channel_options(NAME "serial" TYPE "device"
SPECIFICATIONS "[MS-RDPESP]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -26,7 +26,6 @@ foreach(STATIC_MODULE ${CHANNEL_STATIC_SERVER_MODULES})
set(STATIC_MODULE_NAME ${${STATIC_MODULE}_SERVER_NAME})
set(STATIC_MODULE_CHANNEL ${${STATIC_MODULE}_SERVER_CHANNEL})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${STATIC_MODULE_NAME})
message(STATUS "Adding static server channel: ${STATIC_MODULE_CHANNEL}")
endforeach()
add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS})

View File

@ -1,7 +1,14 @@
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
if(WITH_PCSC)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
endif()
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
@ -10,3 +17,6 @@ define_channel_options(NAME "smartcard" TYPE "device"
SPECIFICATIONS "[MS-RDPESC]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,8 +1,20 @@
set(OPTION_DEFAULT ON)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
if(WIN32)
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
endif()
if(ANDROID)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
endif()
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "tsmf" TYPE "dynamic"
@ -10,3 +22,6 @@ define_channel_options(NAME "tsmf" TYPE "dynamic"
SPECIFICATIONS "[MS-RDPEV]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,8 +1,17 @@
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT OFF)
set(OPTION_SERVER_DEFAULT OFF)
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
set(OPTION_DEFAULT ON)
endif()
define_channel_options(NAME "urbdrc" TYPE "dynamic"
DESCRIPTION "USB Devices Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEUSB]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
#define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -35,6 +35,8 @@ add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} libusb-devman)
set(${MODULE_PREFIX}_LIBS
dbus-glib-1
udev
@ -52,3 +54,4 @@ if(NOT STATIC_CHANNELS)
endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Client")

View File

@ -28,7 +28,12 @@ set(${MODULE_PREFIX}_SRCS
include_directories(../client)
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
if(STATIC_CHANNELS)
add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS})
else()
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
endif()
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
set(${MODULE_PREFIX}_LIBS
@ -39,4 +44,7 @@ set(${MODULE_PREFIX}_LIBS
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
if(NOT STATIC_CHANNELS)
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
endif()

2
client/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
iOS
Android

View File

@ -43,3 +43,10 @@ if(APPLE)
add_subdirectory(Mac)
endif()
if(ANDROID)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Android")
message(STATUS "Adding Android client")
add_subdirectory(Android)
endif()
endif()

View File

@ -81,7 +81,7 @@ set_target_properties(MacFreeRDP PROPERTIES XCODE_ATTRIBUTE_ARCHS "$(NATIVE_ARCH
# Set the info plist to the custom instance
set_target_properties(MacFreeRDP PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
find_optional_package(MacAudio)
#find_optional_package(MacAudio)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${EXTRA_LIBS})

View File

@ -43,6 +43,8 @@
#include <freerdp/utils/memory.h>
#include <freerdp/utils/load_plugin.h>
#include <freerdp/utils/svc_plugin.h>
#include <freerdp/client/file.h>
#include <freerdp/client/channels.h>
#include <freerdp/channels/channels.h>
@ -144,6 +146,7 @@ BOOL wf_pre_connect(freerdp* instance)
{
int i1;
wfInfo* wfi;
rdpFile* file;
wfContext* context;
rdpSettings* settings;
@ -154,6 +157,18 @@ BOOL wf_pre_connect(freerdp* instance)
settings = instance->settings;
settings = instance->settings;
if (settings->connection_file)
{
file = freerdp_client_rdp_file_new();
printf("Using connection file: %s\n", settings->connection_file);
freerdp_client_parse_rdp_file(file, settings->connection_file);
freerdp_client_populate_settings_from_rdp_file(file, settings);
}
settings->os_major_type = OSMAJORTYPE_WINDOWS;
settings->os_minor_type = OSMINORTYPE_WINDOWS_NT;
settings->order_support[NEG_DSTBLT_INDEX] = TRUE;

View File

@ -203,6 +203,7 @@ void xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
void xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
{
#ifdef WITH_XCURSOR
XcursorImage ci;
xfInfo* xfi = ((xfContext*) context)->xfi;
@ -222,29 +223,36 @@ void xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
}
((xfPointer*) pointer)->cursor = XcursorImageLoadCursor(xfi->display, &ci);
free(ci.pixels);
#endif
}
void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
{
#ifdef WITH_XCURSOR
xfInfo* xfi = ((xfContext*) context)->xfi;
if (((xfPointer*) pointer)->cursor != 0)
XFreeCursor(xfi->display, ((xfPointer*) pointer)->cursor);
#endif
}
void xf_Pointer_Set(rdpContext* context, rdpPointer* pointer)
{
#ifdef WITH_XCURSOR
xfInfo* xfi = ((xfContext*) context)->xfi;
/* in RemoteApp mode, window can be null if none has had focus */
if (xfi->window != NULL)
XDefineCursor(xfi->display, xfi->window->handle, ((xfPointer*) pointer)->cursor);
#endif
}
void xf_Pointer_SetNull(rdpContext* context)
{
#ifdef WITH_XCURSOR
xfInfo* xfi = ((xfContext*) context)->xfi;
static Cursor nullcursor = None;
@ -260,16 +268,20 @@ void xf_Pointer_SetNull(rdpContext* context)
ci.pixels = &xp;
nullcursor = XcursorImageLoadCursor(xfi->display, &ci);
}
if (xfi->window != NULL && nullcursor != None)
XDefineCursor(xfi->display, xfi->window->handle, nullcursor);
#endif
}
void xf_Pointer_SetDefault(rdpContext* context)
{
#ifdef WITH_XCURSOR
xfInfo* xfi = ((xfContext*) context)->xfi;
if (xfi->window != NULL)
XUndefineCursor(xfi->display, xfi->window->handle);
#endif
}
/* Glyph Class */

View File

@ -59,6 +59,8 @@
#include <freerdp/client/channels.h>
#include <freerdp/rail.h>
#include <freerdp/client/file.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
@ -480,6 +482,7 @@ int _xf_error_handler(Display* d, XErrorEvent* ev)
BOOL xf_pre_connect(freerdp* instance)
{
xfInfo* xfi;
rdpFile* file;
BOOL bitmap_cache;
rdpSettings* settings;
int arg_parse_result;
@ -504,6 +507,17 @@ BOOL xf_pre_connect(freerdp* instance)
}
settings = instance->settings;
if (settings->connection_file)
{
file = freerdp_client_rdp_file_new();
printf("Using connection file: %s\n", settings->connection_file);
freerdp_client_parse_rdp_file(file, settings->connection_file);
freerdp_client_populate_settings_from_rdp_file(file, settings);
}
bitmap_cache = settings->bitmap_cache;
settings->os_major_type = OSMAJORTYPE_UNIX;

View File

@ -38,9 +38,19 @@ set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL}
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS}
${FREERDP_CHANNELS_CLIENT_LIBS})
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-crt)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
set_target_properties(${MODULE_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "")
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Common")
if(BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -30,3 +30,528 @@
* RDP Settings for Remote Desktop Services in Windows Server 2008 R2:
* http://technet.microsoft.com/en-us/library/ff393699/
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <winpr/crt.h>
#define DEBUG_CLIENT_FILE 1
static BYTE BOM_UTF16_LE[2] = { 0xFF, 0xFE };
static WCHAR CR_LF_STR_W[] = { '\r', '\n', '\0' };
#define INVALID_INTEGER_VALUE 0xFFFFFFFF
BOOL freerdp_client_rdp_file_set_integer(rdpFile* file, char* name, int value)
{
#ifdef DEBUG_CLIENT_FILE
printf("%s:i:%d\n", name, value);
#endif
if (_stricmp(name, "use multimon") == 0)
file->UseMultiMon = value;
else if (_stricmp(name, "screen mode id") == 0)
file->ScreenModeId = value;
else if (_stricmp(name, "span monitors") == 0)
file->SpanMonitors = value;
else if (_stricmp(name, "smartsizing") == 0)
file->SmartSizing = value;
else if (_stricmp(name, "enablesuperpan") == 0)
file->EnableSuperSpan = value;
else if (_stricmp(name, "superpanaccelerationfactor") == 0)
file->SuperSpanAccelerationFactor = value;
else if (_stricmp(name, "desktopwidth") == 0)
file->DesktopWidth = value;
else if (_stricmp(name, "desktopheight") == 0)
file->DesktopHeight = value;
else if (_stricmp(name, "desktop size id") == 0)
file->DesktopSizeId = value;
else if (_stricmp(name, "session bpp") == 0)
file->SessionBpp = value;
else if (_stricmp(name, "compression") == 0)
file->Compression = value;
else if (_stricmp(name, "keyboardhook") == 0)
file->KeyboardHook = value;
else if (_stricmp(name, "disable ctrl+alt+del") == 0)
file->DisableCtrlAltDel = value;
else if (_stricmp(name, "audiomode") == 0)
file->AudioMode = value;
else if (_stricmp(name, "audioqualitymode") == 0)
file->AudioQualityMode = value;
else if (_stricmp(name, "audiocapturemode") == 0)
file->AudioCaptureMode = value;
else if (_stricmp(name, "videoplaybackmode") == 0)
file->VideoPlaybackMode = value;
else if (_stricmp(name, "connection type") == 0)
file->ConnectionType = value;
else if (_stricmp(name, "networkautodetect") == 0)
file->NetworkAutoDetect = value;
else if (_stricmp(name, "bandwidthautodetect") == 0)
file->BandwidthAutoDetect = value;
else if (_stricmp(name, "pinconnectionbar") == 0)
file->PinConnectionBar = value;
else if (_stricmp(name, "displayconnectionbar") == 0)
file->DisplayConnectionBar = value;
else if (_stricmp(name, "workspaceid") == 0)
file->WorkspaceId = value;
else if (_stricmp(name, "enableworkspacereconnect") == 0)
file->EnableWorkspaceReconnect = value;
else if (_stricmp(name, "disable wallpaper") == 0)
file->DisableWallpaper = value;
else if (_stricmp(name, "allow font smoothing") == 0)
file->AllowFontSmoothing = value;
else if (_stricmp(name, "allow desktop composition") == 0)
file->AllowDesktopComposition = value;
else if (_stricmp(name, "disable full window drag") == 0)
file->DisableFullWindowDrag = value;
else if (_stricmp(name, "disable menu anims") == 0)
file->DisableMenuAnims = value;
else if (_stricmp(name, "disable themes") == 0)
file->DisableThemes = value;
else if (_stricmp(name, "disable cursor setting") == 0)
file->DisableCursorSetting = value;
else if (_stricmp(name, "bitmapcachesize") == 0)
file->BitmapCacheSize = value;
else if (_stricmp(name, "bitmapcachepersistenable") == 0)
file->BitmapCachePersistEnable = value;
else if (_stricmp(name, "server port") == 0)
file->ServerPort = value;
else if (_stricmp(name, "redirectdrives") == 0)
file->RedirectDrives = value;
else if (_stricmp(name, "redirectprinters") == 0)
file->RedirectPrinters = value;
else if (_stricmp(name, "redirectcomports") == 0)
file->RedirectComPorts = value;
else if (_stricmp(name, "redirectsmartcards") == 0)
file->RedirectSmartCards = value;
else if (_stricmp(name, "redirectclipboard") == 0)
file->RedirectClipboard = value;
else if (_stricmp(name, "redirectposdevices") == 0)
file->RedirectPosDevices = value;
else if (_stricmp(name, "redirectdirectx") == 0)
file->RedirectDirectX = value;
else if (_stricmp(name, "disableprinterredirection") == 0)
file->DisablePrinterRedirection = value;
else if (_stricmp(name, "disableclipboardredirection") == 0)
file->DisableClipboardRedirection = value;
else if (_stricmp(name, "connect to console") == 0)
file->ConnectToConsole = value;
else if (_stricmp(name, "administrative session") == 0)
file->AdministrativeSession = value;
else if (_stricmp(name, "autoreconnection enabled") == 0)
file->AutoReconnectionEnabled = value;
else if (_stricmp(name, "autoreconnect max retries") == 0)
file->AutoReconnectMaxRetries = value;
else if (_stricmp(name, "public mode") == 0)
file->PublicMode = value;
else if (_stricmp(name, "authentication level") == 0)
file->AuthenticationLevel = value;
else if (_stricmp(name, "promptcredentialonce") == 0)
file->PromptCredentialOnce = value;
else if (_stricmp(name, "prompt for credentials") == 0)
file->PromptForCredentials = value;
else if (_stricmp(name, "promptcredentialonce") == 0)
file->PromptForCredentialsOnce = value;
else if (_stricmp(name, "negotiate security layer") == 0)
file->NegotiateSecurityLayer = value;
else if (_stricmp(name, "enablecredsspsupport") == 0)
file->EnableCredSSPSupport = value;
else if (_stricmp(name, "remoteapplicationmode") == 0)
file->RemoteApplicationMode = value;
else if (_stricmp(name, "remoteapplicationexpandcmdline") == 0)
file->RemoteApplicationExpandCmdLine = value;
else if (_stricmp(name, "remoteapplicationexpandworkingdir") == 0)
file->RemoteApplicationExpandWorkingDir = value;
else if (_stricmp(name, "disableconnectionsharing") == 0)
file->DisableConnectionSharing = value;
else if (_stricmp(name, "disableremoteappcapscheck") == 0)
file->DisableRemoteAppCapsCheck = value;
else if (_stricmp(name, "gatewayusagemethod") == 0)
file->GatewayUsageMethod = value;
else if (_stricmp(name, "gatewayprofileusagemethod") == 0)
file->GatewayProfileUsageMethod = value;
else if (_stricmp(name, "gatewaycredentialssource") == 0)
file->GatewayCredentialsSource = value;
else if (_stricmp(name, "use redirection server name") == 0)
file->UseRedirectionServerName = value;
else if (_stricmp(name, "rdgiskdcproxy") == 0)
file->RdgIsKdcProxy = value;
else
return FALSE;
return TRUE;
}
void freerdp_client_parse_rdp_file_integer_unicode(rdpFile* file, WCHAR* name, WCHAR* value)
{
int length;
int ivalue;
char* nameA;
char* valueA;
length = _wcslen(name);
nameA = (char*) malloc(length + 1);
WideCharToMultiByte(CP_UTF8, 0, name, length, nameA, length, NULL, NULL);
nameA[length] = '\0';
length = _wcslen(value);
valueA = (char*) malloc(length + 1);
WideCharToMultiByte(CP_UTF8, 0, value, length, valueA, length, NULL, NULL);
valueA[length] = '\0';
ivalue = atoi(valueA);
freerdp_client_rdp_file_set_integer(file, nameA, ivalue);
free(nameA);
free(valueA);
}
void freerdp_client_parse_rdp_file_integer_ascii(rdpFile* file, char* name, char* value)
{
int ivalue = atoi(value);
freerdp_client_rdp_file_set_integer(file, name, ivalue);
}
BOOL freerdp_client_rdp_file_set_string(rdpFile* file, char* name, char* value)
{
#ifdef DEBUG_CLIENT_FILE
printf("%s:s:%s\n", name, value);
#endif
if (_stricmp(name, "username") == 0)
file->Username = value;
else if (_stricmp(name, "domain") == 0)
file->Domain = value;
else if (_stricmp(name, "full address") == 0)
file->FullAddress = value;
else if (_stricmp(name, "alternate full address") == 0)
file->AlternateFullAddress = value;
else if (_stricmp(name, "usbdevicestoredirect") == 0)
file->UsbDevicesToRedirect = value;
else if (_stricmp(name, "loadbalanceinfo") == 0)
file->LoadBalanceInfo = value;
else if (_stricmp(name, "remoteapplicationname") == 0)
file->RemoteApplicationName = value;
else if (_stricmp(name, "remoteapplicationicon") == 0)
file->RemoteApplicationIcon = value;
else if (_stricmp(name, "remoteapplicationprogram") == 0)
file->RemoteApplicationProgram = value;
else if (_stricmp(name, "remoteapplicationfile") == 0)
file->RemoteApplicationFile = value;
else if (_stricmp(name, "remoteapplicationcmdline") == 0)
file->RemoteApplicationCmdLine = value;
else if (_stricmp(name, "alternate shell") == 0)
file->AlternateShell = value;
else if (_stricmp(name, "shell working directory") == 0)
file->ShellWorkingDirectory = value;
else if (_stricmp(name, "gatewayhostname") == 0)
file->GatewayHostname = value;
else if (_stricmp(name, "kdcproxyname") == 0)
file->KdcProxyName = value;
else if (_stricmp(name, "drivestoredirect") == 0)
file->DrivesToRedirect = value;
else if (_stricmp(name, "devicestoredirect") == 0)
file->DevicesToRedirect = value;
else if (_stricmp(name, "winposstr") == 0)
file->WinPosStr = value;
else
return FALSE;
return TRUE;
}
void freerdp_client_parse_rdp_file_string_unicode(rdpFile* file, WCHAR* name, WCHAR* value)
{
int length;
char* nameA;
char* valueA;
length = _wcslen(name);
nameA = (char*) malloc(length + 1);
WideCharToMultiByte(CP_UTF8, 0, name, length, nameA, length, NULL, NULL);
nameA[length] = '\0';
length = _wcslen(value);
valueA = (char*) malloc(length + 1);
WideCharToMultiByte(CP_UTF8, 0, value, length, valueA, length, NULL, NULL);
valueA[length] = '\0';
if (!freerdp_client_rdp_file_set_string(file, nameA, valueA))
free(valueA);
free(nameA);
}
void freerdp_client_parse_rdp_file_string_ascii(rdpFile* file, char* name, char* value)
{
freerdp_client_rdp_file_set_string(file, name, value);
}
BOOL freerdp_client_parse_rdp_file_buffer_ascii(rdpFile* file, BYTE* buffer, size_t size)
{
int length;
char* line;
char* type;
char* context;
char *d1, *d2;
char *beg, *end;
char *name, *value;
line = strtok_s((char*) buffer, "\r\n", &context);
while (line != NULL)
{
length = strlen(line);
if (length > 1)
{
beg = line;
end = &line[length - 1];
d1 = strchr(line, ':');
if (!d1)
goto next_line; /* not first delimiter */
type = &d1[1];
d2 = strchr(type, ':');
if (!d2)
goto next_line; /* no second delimiter */
if ((d2 - d1) != 2)
goto next_line; /* improper type length */
if (d2 == end)
goto next_line; /* no value */
*d1 = 0;
*d2 = 0;
name = beg;
value = &d2[1];
if (*type == 'i')
{
/* integer type */
freerdp_client_parse_rdp_file_integer_ascii(file, name, value);
}
else if (*type == 's')
{
/* string type */
freerdp_client_parse_rdp_file_string_ascii(file, name, value);
}
else if (*type == 'b')
{
/* binary type */
}
}
next_line:
line = strtok_s(NULL, "\r\n", &context);
}
return TRUE;
}
BOOL freerdp_client_parse_rdp_file_buffer_unicode(rdpFile* file, BYTE* buffer, size_t size)
{
int length;
WCHAR* line;
WCHAR* type;
WCHAR* context;
WCHAR *d1, *d2;
WCHAR *beg, *end;
WCHAR *name, *value;
line = wcstok_s((WCHAR*) buffer, CR_LF_STR_W, &context);
while (line != NULL)
{
length = _wcslen(line);
if (length > 1)
{
beg = line;
end = &line[length - 1];
d1 = _wcschr(line, ':');
if (!d1)
goto next_line; /* not first delimiter */
type = &d1[1];
d2 = _wcschr(type, ':');
if (!d2)
goto next_line; /* no second delimiter */
if ((d2 - d1) != 2)
goto next_line; /* improper type length */
if (d2 == end)
goto next_line; /* no value */
*d1 = 0;
*d2 = 0;
name = beg;
value = &d2[1];
if (*type == 'i')
{
/* integer type */
freerdp_client_parse_rdp_file_integer_unicode(file, name, value);
}
else if (*type == 's')
{
/* string type */
freerdp_client_parse_rdp_file_string_unicode(file, name, value);
}
else if (*type == 'b')
{
/* binary type */
}
}
next_line:
line = wcstok_s(NULL, CR_LF_STR_W, &context);
}
return TRUE;
}
BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, BYTE* buffer, size_t size)
{
if (size < 2)
return FALSE;
if ((buffer[0] == BOM_UTF16_LE[0]) && (buffer[1] == BOM_UTF16_LE[1]))
return freerdp_client_parse_rdp_file_buffer_unicode(file, &buffer[2], size - 2);
return freerdp_client_parse_rdp_file_buffer_ascii(file, buffer, size);
}
BOOL freerdp_client_parse_rdp_file(rdpFile* file, char* name)
{
BYTE* buffer;
FILE* fp = NULL;
size_t read_size;
long int file_size;
fp = fopen(name, "r");
if (!fp)
return FALSE;
fseek(fp, 0, SEEK_END);
file_size = ftell(fp);
fseek(fp, 0, SEEK_SET);
if (file_size < 1)
return FALSE;
buffer = (BYTE*) malloc(file_size);
read_size = fread(buffer, file_size, 1, fp);
if (!read_size)
{
if (!ferror(fp))
read_size = file_size;
}
if (read_size < 1)
{
free(buffer);
buffer = NULL;
return FALSE;
}
return freerdp_client_parse_rdp_file_buffer(file, buffer, file_size);
}
BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* settings)
{
if (~((size_t) file->Domain))
settings->domain = file->Domain;
if (~((size_t) file->Username))
{
char* p;
size_t size;
p = strchr(file->Username, '\\');
if (p)
{
size = p - file->Username;
settings->domain = (char*) malloc(size + 1);
CopyMemory(settings->domain, file->Username, size);
settings->domain[size] = 0;
size = strlen(file->Username) - size - 1;
settings->username = (char*) malloc(size + 1);
CopyMemory(settings->username, &file->Username[p - file->Username + 1], size);
settings->username[size] = 0;
}
else
{
settings->username = file->Username;
}
}
if (~file->ServerPort)
settings->port = file->ServerPort;
if (~((size_t) file->FullAddress))
settings->hostname = file->FullAddress;
if (~file->DesktopWidth)
settings->width = file->DesktopWidth;
if (~file->DesktopHeight)
settings->height = file->DesktopHeight;
if (~file->SessionBpp)
settings->color_depth = file->SessionBpp;
if (~file->ConnectToConsole)
settings->console_session = file->ConnectToConsole;
if (~file->AdministrativeSession)
settings->console_session = file->AdministrativeSession;
if (~file->NegotiateSecurityLayer)
settings->security_layer_negotiation = file->NegotiateSecurityLayer;
if (~file->EnableCredSSPSupport)
settings->nla_security = file->EnableCredSSPSupport;
if (~((size_t) file->AlternateShell))
settings->shell = file->AlternateShell;
if (~((size_t) file->ShellWorkingDirectory))
settings->directory = file->ShellWorkingDirectory;
if (~((size_t) file->GatewayHostname))
settings->tsg_hostname = file->GatewayHostname;
if (~file->GatewayUsageMethod)
settings->ts_gateway = TRUE;
if (~file->PromptCredentialOnce)
settings->tsg_same_credentials = TRUE;
if (~file->RemoteApplicationMode)
settings->remote_app = file->RemoteApplicationMode;
return TRUE;
}
rdpFile* freerdp_client_rdp_file_new()
{
rdpFile* file;
file = (rdpFile*) malloc(sizeof(rdpFile));
FillMemory(file, sizeof(rdpFile), 0xFF);
return file;
}
void freerdp_client_rdp_file_free(rdpFile* file)
{
free(file);
}

3
client/common/test/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
TestClient
TestClient.c

View File

@ -0,0 +1,28 @@
set(MODULE_NAME "TestClient")
set(MODULE_PREFIX "TEST_CLIENT")
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestClientRdpFile.c)
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
${${MODULE_PREFIX}_TESTS})
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
foreach(test ${${MODULE_PREFIX}_TESTS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
endforeach()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Client/Test")

View File

@ -0,0 +1,330 @@
#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/windows.h>
#include <freerdp/client/file.h>
static BYTE testRdpFileUTF16[] =
{
0xff, 0xfe, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x65, 0x00,
0x6e, 0x00, 0x20, 0x00, 0x6d, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00,
0x20, 0x00, 0x69, 0x00, 0x64, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
0x32, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x75, 0x00, 0x73, 0x00, 0x65, 0x00,
0x20, 0x00, 0x6d, 0x00, 0x75, 0x00, 0x6c, 0x00, 0x74, 0x00, 0x69, 0x00,
0x6d, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00, 0x65, 0x00, 0x73, 0x00,
0x6b, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x70, 0x00, 0x77, 0x00, 0x69, 0x00,
0x64, 0x00, 0x74, 0x00, 0x68, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
0x31, 0x00, 0x39, 0x00, 0x32, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00,
0x64, 0x00, 0x65, 0x00, 0x73, 0x00, 0x6b, 0x00, 0x74, 0x00, 0x6f, 0x00,
0x70, 0x00, 0x68, 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00,
0x74, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x30, 0x00,
0x38, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x73, 0x00, 0x65, 0x00,
0x73, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x20, 0x00,
0x62, 0x00, 0x70, 0x00, 0x70, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
0x33, 0x00, 0x32, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x77, 0x00, 0x69, 0x00,
0x6e, 0x00, 0x70, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x73, 0x00, 0x74, 0x00,
0x72, 0x00, 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x2c, 0x00,
0x31, 0x00, 0x2c, 0x00, 0x35, 0x00, 0x35, 0x00, 0x33, 0x00, 0x2c, 0x00,
0x32, 0x00, 0x31, 0x00, 0x31, 0x00, 0x2c, 0x00, 0x31, 0x00, 0x33, 0x00,
0x35, 0x00, 0x33, 0x00, 0x2c, 0x00, 0x38, 0x00, 0x31, 0x00, 0x31, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x70, 0x00,
0x72, 0x00, 0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00,
0x6e, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00,
0x0a, 0x00, 0x6b, 0x00, 0x65, 0x00, 0x79, 0x00, 0x62, 0x00, 0x6f, 0x00,
0x61, 0x00, 0x72, 0x00, 0x64, 0x00, 0x68, 0x00, 0x6f, 0x00, 0x6f, 0x00,
0x6b, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x32, 0x00, 0x0d, 0x00,
0x0a, 0x00, 0x61, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6f, 0x00,
0x63, 0x00, 0x61, 0x00, 0x70, 0x00, 0x74, 0x00, 0x75, 0x00, 0x72, 0x00,
0x65, 0x00, 0x6d, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00, 0x3a, 0x00,
0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x76, 0x00,
0x69, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6f, 0x00, 0x70, 0x00, 0x6c, 0x00,
0x61, 0x00, 0x79, 0x00, 0x62, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00,
0x6d, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00, 0x3a, 0x00, 0x69, 0x00,
0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x63, 0x00, 0x6f, 0x00,
0x6e, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00,
0x6f, 0x00, 0x6e, 0x00, 0x20, 0x00, 0x74, 0x00, 0x79, 0x00, 0x70, 0x00,
0x65, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x37, 0x00, 0x0d, 0x00,
0x0a, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x74, 0x00, 0x77, 0x00, 0x6f, 0x00,
0x72, 0x00, 0x6b, 0x00, 0x61, 0x00, 0x75, 0x00, 0x74, 0x00, 0x6f, 0x00,
0x64, 0x00, 0x65, 0x00, 0x74, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00,
0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00,
0x62, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x77, 0x00, 0x69, 0x00,
0x64, 0x00, 0x74, 0x00, 0x68, 0x00, 0x61, 0x00, 0x75, 0x00, 0x74, 0x00,
0x6f, 0x00, 0x64, 0x00, 0x65, 0x00, 0x74, 0x00, 0x65, 0x00, 0x63, 0x00,
0x74, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00,
0x0a, 0x00, 0x64, 0x00, 0x69, 0x00, 0x73, 0x00, 0x70, 0x00, 0x6c, 0x00,
0x61, 0x00, 0x79, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x6e, 0x00,
0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00,
0x62, 0x00, 0x61, 0x00, 0x72, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00,
0x62, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x77, 0x00, 0x6f, 0x00, 0x72, 0x00,
0x6b, 0x00, 0x73, 0x00, 0x70, 0x00, 0x61, 0x00, 0x63, 0x00, 0x65, 0x00,
0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x6e, 0x00,
0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00, 0x69, 0x00, 0x73, 0x00,
0x61, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x20, 0x00, 0x77, 0x00,
0x61, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x70, 0x00, 0x61, 0x00, 0x70, 0x00,
0x65, 0x00, 0x72, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x6f, 0x00,
0x77, 0x00, 0x20, 0x00, 0x66, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x74, 0x00,
0x20, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x74, 0x00,
0x68, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x3a, 0x00, 0x69, 0x00,
0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x61, 0x00, 0x6c, 0x00,
0x6c, 0x00, 0x6f, 0x00, 0x77, 0x00, 0x20, 0x00, 0x64, 0x00, 0x65, 0x00,
0x73, 0x00, 0x6b, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x70, 0x00, 0x20, 0x00,
0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x70, 0x00, 0x6f, 0x00, 0x73, 0x00,
0x69, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x3a, 0x00,
0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00,
0x69, 0x00, 0x73, 0x00, 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00,
0x20, 0x00, 0x66, 0x00, 0x75, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x20, 0x00,
0x77, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x77, 0x00,
0x20, 0x00, 0x64, 0x00, 0x72, 0x00, 0x61, 0x00, 0x67, 0x00, 0x3a, 0x00,
0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00,
0x69, 0x00, 0x73, 0x00, 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00,
0x20, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x75, 0x00, 0x20, 0x00,
0x61, 0x00, 0x6e, 0x00, 0x69, 0x00, 0x6d, 0x00, 0x73, 0x00, 0x3a, 0x00,
0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00,
0x69, 0x00, 0x73, 0x00, 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00,
0x20, 0x00, 0x74, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x65, 0x00,
0x73, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00,
0x0a, 0x00, 0x64, 0x00, 0x69, 0x00, 0x73, 0x00, 0x61, 0x00, 0x62, 0x00,
0x6c, 0x00, 0x65, 0x00, 0x20, 0x00, 0x63, 0x00, 0x75, 0x00, 0x72, 0x00,
0x73, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x20, 0x00, 0x73, 0x00, 0x65, 0x00,
0x74, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x3a, 0x00,
0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x62, 0x00,
0x69, 0x00, 0x74, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x70, 0x00, 0x63, 0x00,
0x61, 0x00, 0x63, 0x00, 0x68, 0x00, 0x65, 0x00, 0x70, 0x00, 0x65, 0x00,
0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x65, 0x00,
0x6e, 0x00, 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x3a, 0x00,
0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x66, 0x00,
0x75, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x61, 0x00, 0x64, 0x00,
0x64, 0x00, 0x72, 0x00, 0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x3a, 0x00,
0x73, 0x00, 0x3a, 0x00, 0x4c, 0x00, 0x41, 0x00, 0x42, 0x00, 0x31, 0x00,
0x2d, 0x00, 0x57, 0x00, 0x37, 0x00, 0x2d, 0x00, 0x44, 0x00, 0x4d, 0x00,
0x2d, 0x00, 0x30, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x6c, 0x00, 0x61, 0x00,
0x62, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x61, 0x00, 0x77, 0x00, 0x61, 0x00,
0x6b, 0x00, 0x65, 0x00, 0x2e, 0x00, 0x6c, 0x00, 0x6f, 0x00, 0x63, 0x00,
0x61, 0x00, 0x6c, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x61, 0x00, 0x75, 0x00,
0x64, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x6f, 0x00, 0x64, 0x00,
0x65, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00,
0x0a, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x69, 0x00, 0x72, 0x00,
0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x70, 0x00, 0x72, 0x00, 0x69, 0x00,
0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x3a, 0x00,
0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x72, 0x00,
0x65, 0x00, 0x64, 0x00, 0x69, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00,
0x74, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x70, 0x00, 0x6f, 0x00,
0x72, 0x00, 0x74, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00,
0x69, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x73, 0x00,
0x6d, 0x00, 0x61, 0x00, 0x72, 0x00, 0x74, 0x00, 0x63, 0x00, 0x61, 0x00,
0x72, 0x00, 0x64, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00,
0x69, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x63, 0x00,
0x6c, 0x00, 0x69, 0x00, 0x70, 0x00, 0x62, 0x00, 0x6f, 0x00, 0x61, 0x00,
0x72, 0x00, 0x64, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x69, 0x00,
0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x70, 0x00, 0x6f, 0x00,
0x73, 0x00, 0x64, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00,
0x65, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x61, 0x00, 0x75, 0x00, 0x74, 0x00, 0x6f, 0x00,
0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x6e, 0x00,
0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00,
0x20, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00,
0x65, 0x00, 0x64, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x61, 0x00, 0x75, 0x00, 0x74, 0x00, 0x68, 0x00,
0x65, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x69, 0x00, 0x63, 0x00, 0x61, 0x00,
0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x20, 0x00, 0x6c, 0x00,
0x65, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x3a, 0x00, 0x69, 0x00,
0x3a, 0x00, 0x32, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x72, 0x00,
0x6f, 0x00, 0x6d, 0x00, 0x70, 0x00, 0x74, 0x00, 0x20, 0x00, 0x66, 0x00,
0x6f, 0x00, 0x72, 0x00, 0x20, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00,
0x64, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x69, 0x00, 0x61, 0x00,
0x6c, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x67, 0x00, 0x6f, 0x00,
0x74, 0x00, 0x69, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x20, 0x00,
0x73, 0x00, 0x65, 0x00, 0x63, 0x00, 0x75, 0x00, 0x72, 0x00, 0x69, 0x00,
0x74, 0x00, 0x79, 0x00, 0x20, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x79, 0x00,
0x65, 0x00, 0x72, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x72, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x6f, 0x00,
0x74, 0x00, 0x65, 0x00, 0x61, 0x00, 0x70, 0x00, 0x70, 0x00, 0x6c, 0x00,
0x69, 0x00, 0x63, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00,
0x6e, 0x00, 0x6d, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00, 0x3a, 0x00,
0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x61, 0x00,
0x6c, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6e, 0x00, 0x61, 0x00,
0x74, 0x00, 0x65, 0x00, 0x20, 0x00, 0x73, 0x00, 0x68, 0x00, 0x65, 0x00,
0x6c, 0x00, 0x6c, 0x00, 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x0d, 0x00,
0x0a, 0x00, 0x73, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x6c, 0x00,
0x20, 0x00, 0x77, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x6b, 0x00, 0x69, 0x00,
0x6e, 0x00, 0x67, 0x00, 0x20, 0x00, 0x64, 0x00, 0x69, 0x00, 0x72, 0x00,
0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x79, 0x00,
0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x67, 0x00,
0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x77, 0x00, 0x61, 0x00, 0x79, 0x00,
0x68, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x74, 0x00, 0x6e, 0x00, 0x61, 0x00,
0x6d, 0x00, 0x65, 0x00, 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x4c, 0x00,
0x41, 0x00, 0x42, 0x00, 0x31, 0x00, 0x2d, 0x00, 0x57, 0x00, 0x32, 0x00,
0x4b, 0x00, 0x38, 0x00, 0x52, 0x00, 0x32, 0x00, 0x2d, 0x00, 0x47, 0x00,
0x57, 0x00, 0x2e, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x62, 0x00, 0x31, 0x00,
0x2e, 0x00, 0x61, 0x00, 0x77, 0x00, 0x61, 0x00, 0x6b, 0x00, 0x65, 0x00,
0x2e, 0x00, 0x6c, 0x00, 0x6f, 0x00, 0x63, 0x00, 0x61, 0x00, 0x6c, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x67, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00,
0x77, 0x00, 0x61, 0x00, 0x79, 0x00, 0x75, 0x00, 0x73, 0x00, 0x61, 0x00,
0x67, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x74, 0x00, 0x68, 0x00,
0x6f, 0x00, 0x64, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x67, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00,
0x77, 0x00, 0x61, 0x00, 0x79, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00,
0x64, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x69, 0x00, 0x61, 0x00,
0x6c, 0x00, 0x73, 0x00, 0x73, 0x00, 0x6f, 0x00, 0x75, 0x00, 0x72, 0x00,
0x63, 0x00, 0x65, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x67, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00,
0x77, 0x00, 0x61, 0x00, 0x79, 0x00, 0x70, 0x00, 0x72, 0x00, 0x6f, 0x00,
0x66, 0x00, 0x69, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x75, 0x00, 0x73, 0x00,
0x61, 0x00, 0x67, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x74, 0x00,
0x68, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x72, 0x00, 0x6f, 0x00,
0x6d, 0x00, 0x70, 0x00, 0x74, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00,
0x64, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x69, 0x00, 0x61, 0x00,
0x6c, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x63, 0x00, 0x65, 0x00, 0x3a, 0x00,
0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x75, 0x00,
0x73, 0x00, 0x65, 0x00, 0x20, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00,
0x69, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00,
0x6f, 0x00, 0x6e, 0x00, 0x20, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00,
0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x6e, 0x00, 0x61, 0x00,
0x6d, 0x00, 0x65, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x72, 0x00, 0x64, 0x00, 0x67, 0x00, 0x69, 0x00,
0x73, 0x00, 0x6b, 0x00, 0x64, 0x00, 0x63, 0x00, 0x70, 0x00, 0x72, 0x00,
0x6f, 0x00, 0x78, 0x00, 0x79, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x6b, 0x00, 0x64, 0x00, 0x63, 0x00,
0x70, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x78, 0x00, 0x79, 0x00, 0x6e, 0x00,
0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00,
0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00, 0x72, 0x00, 0x69, 0x00, 0x76, 0x00,
0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x65, 0x00,
0x64, 0x00, 0x69, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00,
0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x2a, 0x00, 0x0d, 0x00, 0x0a, 0x00,
0x75, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6e, 0x00, 0x61, 0x00,
0x6d, 0x00, 0x65, 0x00, 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x4c, 0x00,
0x41, 0x00, 0x42, 0x00, 0x31, 0x00, 0x5c, 0x00, 0x4a, 0x00, 0x6f, 0x00,
0x68, 0x00, 0x6e, 0x00, 0x44, 0x00, 0x6f, 0x00, 0x65, 0x00, 0x0d, 0x00,
0x0a, 0x00
};
static char testRdpFileUTF8[] =
"screen mode id:i:2\n"
"use multimon:i:0\n"
"desktopwidth:i:1920\n"
"desktopheight:i:1080\n"
"session bpp:i:32\n"
"winposstr:s:0,1,553,211,1353,811\n"
"compression:i:1\n"
"keyboardhook:i:2\n"
"audiocapturemode:i:0\n"
"videoplaybackmode:i:1\n"
"connection type:i:7\n"
"networkautodetect:i:1\n"
"bandwidthautodetect:i:1\n"
"displayconnectionbar:i:1\n"
"enableworkspacereconnect:i:0\n"
"disable wallpaper:i:0\n"
"allow font smoothing:i:0\n"
"allow desktop composition:i:0\n"
"disable full window drag:i:1\n"
"disable menu anims:i:1\n"
"disable themes:i:0\n"
"disable cursor setting:i:0\n"
"bitmapcachepersistenable:i:1\n"
"full address:s:LAB1-W7-DM-01.lab1.awake.local\n"
"audiomode:i:0\n"
"redirectprinters:i:1\n"
"redirectcomports:i:0\n"
"redirectsmartcards:i:1\n"
"redirectclipboard:i:1\n"
"redirectposdevices:i:0\n"
"autoreconnection enabled:i:1\n"
"authentication level:i:2\n"
"prompt for credentials:i:0\n"
"negotiate security layer:i:1\n"
"remoteapplicationmode:i:0\n"
"alternate shell:s:\n"
"shell working directory:s:\n"
"gatewayhostname:s:LAB1-W2K8R2-GW.lab1.awake.local\n"
"gatewayusagemethod:i:1\n"
"gatewaycredentialssource:i:0\n"
"gatewayprofileusagemethod:i:1\n"
"promptcredentialonce:i:1\n"
"use redirection server name:i:0\n"
"rdgiskdcproxy:i:0\n"
"kdcproxyname:s:\n"
"drivestoredirect:s:*\n"
"username:s:LAB1\\JohnDoe\n";
int TestClientRdpFile(int argc, char* argv[])
{
rdpFile* file;
/* Unicode */
file = freerdp_client_rdp_file_new();
freerdp_client_parse_rdp_file_buffer(file, testRdpFileUTF16, sizeof(testRdpFileUTF16));
if (file->UseMultiMon != 0)
{
printf("UseMultiMon mismatch: Actual: %d, Expected: %d\n", file->UseMultiMon, 0);
return -1;
}
if (file->ScreenModeId != 2)
{
printf("ScreenModeId mismatch: Actual: %d, Expected: %d\n", file->ScreenModeId, 2);
return -1;
}
if (file->GatewayProfileUsageMethod != 1)
{
printf("GatewayProfileUsageMethod mismatch: Actual: %d, Expected: %d\n", file->GatewayProfileUsageMethod, 1);
return -1;
}
if (strcmp(file->GatewayHostname, "LAB1-W2K8R2-GW.lab1.awake.local") != 0)
{
printf("GatewayHostname mismatch: Actual: %s, Expected: %s\n",
file->GatewayHostname, "LAB1-W2K8R2-GW.lab1.awake.local");
return -1;
}
freerdp_client_rdp_file_free(file);
/* Ascii */
file = freerdp_client_rdp_file_new();
freerdp_client_parse_rdp_file_buffer(file, (BYTE*) testRdpFileUTF8, sizeof(testRdpFileUTF8));
if (file->UseMultiMon != 0)
{
printf("UseMultiMon mismatch: Actual: %d, Expected: %d\n", file->UseMultiMon, 0);
return -1;
}
if (file->ScreenModeId != 2)
{
printf("ScreenModeId mismatch: Actual: %d, Expected: %d\n", file->ScreenModeId, 2);
return -1;
}
if (file->GatewayProfileUsageMethod != 1)
{
printf("GatewayProfileUsageMethod mismatch: Actual: %d, Expected: %d\n", file->GatewayProfileUsageMethod, 1);
return -1;
}
if (strcmp(file->GatewayHostname, "LAB1-W2K8R2-GW.lab1.awake.local") != 0)
{
printf("GatewayHostname mismatch: Actual: %s, Expected: %s\n",
file->GatewayHostname, "LAB1-W2K8R2-GW.lab1.awake.local");
return -1;
}
freerdp_client_rdp_file_free(file);
return 0;
}

1125
cmake/AndroidToolchain.cmake Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,8 @@ if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86") AND (CMAKE_SIZEOF_VOID_P EQU
set(TARGET_ARCH "x86")
elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
set(TARGET_ARCH "x64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
set(TARGET_ARCH "ARM")
endif()
option(WITH_MANPAGES "Generate manpages." ON)
@ -14,7 +16,11 @@ else()
option(WITH_SSE2 "Enable SSE2 optimization." OFF)
endif()
option(WITH_NEON "Enable NEON optimization." OFF)
if((TARGET_ARCH MATCHES "ARM") AND (NOT DEFINED WITH_NEON))
option(WITH_NEON "Enable NEON optimization." ON)
else()
option(WITH_NEON "Enable NEON optimization." OFF)
endif()
option(WITH_JPEG "Use JPEG decoding." OFF)
@ -31,13 +37,18 @@ option(BUILD_TESTING "Build unit tests" OFF)
option(WITH_SAMPLE "Build sample code" OFF)
if(${CMAKE_VERSION} VERSION_GREATER 2.8.8)
option(MONOLITHIC_BUILD "Use monolithic build" OFF)
if(ANDROID)
option(MONOLITHIC_BUILD "Use monolithic build" ON)
else()
option(MONOLITHIC_BUILD "Use monolithic build" OFF)
endif()
endif()
option(WITH_CLIENT "Build client binaries" ON)
option(WITH_SERVER "Build server binaries" OFF)
option(STATIC_CHANNELS "Build channels statically" ON)
option(WITH_CHANNELS "Build virtual channel plugins" ON)
if(WITH_CLIENT AND WITH_CHANNELS)

View File

@ -20,6 +20,7 @@
#ifndef FREERDP_CLIENT_RDP_FILE
#define FREERDP_CLIENT_RDP_FILE
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
struct rdp_file
@ -71,8 +72,8 @@ struct rdp_file
LPSTR Domain; /* domain */
PBYTE Password51; /* password 51 */
LPTSTR FullAddress; /* full address */
LPTSTR AlternateFullAddress; /* alternate full address */
LPSTR FullAddress; /* full address */
LPSTR AlternateFullAddress; /* alternate full address */
DWORD ServerPort; /* server port */
DWORD RedirectDrives; /* redirectdrives */
@ -98,7 +99,7 @@ struct rdp_file
DWORD PromptForCredentialsOnce; /* promptcredentialonce */
DWORD NegotiateSecurityLayer; /* negotiate security layer */
DWORD EnableCredSSPSupport; /* enablecredsspsupport */
LPSTR LoadBalanceInfo; /* LoadBalanceInfo */
LPSTR LoadBalanceInfo; /* loadbalanceinfo */
DWORD RemoteApplicationMode; /* remoteapplicationmode */
LPSTR RemoteApplicationName; /* remoteapplicationname */
@ -115,14 +116,14 @@ struct rdp_file
LPSTR ShellWorkingDirectory; /* shell working directory */
LPSTR GatewayHostname; /* gatewayhostname */
LPSTR GatewayUsageMethod; /* gatewayusagemethod */
LPSTR GatewayProfileUsageMethod; /* gatewayprofileusagemethod */
LPSTR GatewayCredentialsSource; /* gatewaycredentialssource */
DWORD GatewayUsageMethod; /* gatewayusagemethod */
DWORD GatewayProfileUsageMethod; /* gatewayprofileusagemethod */
DWORD GatewayCredentialsSource; /* gatewaycredentialssource */
DWORD UseRedirectionServerName; /* use redirection server name */
DWORD RdgIsKdcProxy; /* rdgiskdcproxy */
DWORD KdcProxyName; /* kdcproxyname */
LPSTR KdcProxyName; /* kdcproxyname */
LPSTR DrivesToRedirect; /* drivestoredirect */
LPSTR DevicesToRedirect; /* devicestoredirect */
@ -131,4 +132,11 @@ struct rdp_file
typedef struct rdp_file rdpFile;
FREERDP_API BOOL freerdp_client_parse_rdp_file(rdpFile* file, char* name);
FREERDP_API BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, BYTE* buffer, size_t size);
FREERDP_API BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* settings);
FREERDP_API rdpFile* freerdp_client_rdp_file_new();
FREERDP_API void freerdp_client_rdp_file_free(rdpFile* file);
#endif /* FREERDP_CLIENT_RDP_FILE */

View File

@ -301,7 +301,11 @@ struct rdp_settings
ALIGN64 BOOL send_preconnection_pdu; /* 72 */
ALIGN64 UINT32 preconnection_id; /* 73 */
ALIGN64 char* preconnection_blob; /* 74 */
UINT64 paddingC[80 - 75]; /* 75 */
ALIGN64 char* computer_name; /* 75 */
ALIGN64 char* connection_file; /* 76 */
ALIGN64 char* tsg_domain; /* 77 */
ALIGN64 BOOL tsg_same_credentials; /* 78 */
UINT64 paddingC[80 - 79]; /* 79 */
/* User Interface Parameters */
ALIGN64 BOOL sw_gdi; /* 80 */

View File

@ -61,17 +61,24 @@ if(WITH_SSE2)
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_SSE2_SRCS})
if(CMAKE_COMPILER_IS_GNUCC)
set_property(SOURCE rfx_sse2.c nsc_sse2.c PROPERTY COMPILE_FLAGS "-msse2")
set_source_files_properties(${${MODULE_PREFIX}_SSE2_SRCS} PROPERTIES COMPILE_FLAGS "-msse2")
endif()
if(MSVC)
set_property(SOURCE rfx_sse2.c nsc_sse2.c PROPERTY COMPILE_FLAGS "/arch:SSE2")
set_source_files_properties(${${MODULE_PREFIX}_SSE2_SRCS} PROPERTIES COMPILE_FLAGS "/arch:SSE2")
endif()
endif()
if(WITH_NEON)
if(ANDROID)
set(ANDROID_CPU_FEATURES_PATH "${ANDROID_NDK}/sources/android/cpufeatures")
include_directories(${ANDROID_CPU_FEATURES_PATH})
set(${MODULE_PREFIX}_NEON_SRCS ${${MODULE_PREFIX}_NEON_SRCS}
${ANDROID_CPU_FEATURES_PATH}/cpu-features.c
${ANDROID_CPU_FEATURES_PATH}/cpu-features.h)
endif()
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_NEON_SRCS})
set_property(SOURCE rfx_neon.c PROPERTY COMPILE_FLAGS "-mfpu=neon -mfloat-abi=softfp")
set_source_files_properties(${${MODULE_PREFIX}_NEON_SRCS} PROPERTIES COMPILE_FLAGS "-mfpu=neon -mfloat-abi=softfp -Wno-unused-variable")
endif()
if(WITH_JPEG)

View File

@ -31,28 +31,27 @@
#include "rfx_types.h"
#include "rfx_neon.h"
#if defined(ANDROID)
#include <cpu-features.h>
#if ANDROID
#include "cpu-features.h"
#endif
void rfx_decode_YCbCr_to_RGB_NEON(INT16 * y_r_buffer, INT16 * cb_g_buffer, INT16 * cr_b_buffer)
{
int16x8_t zero = vdupq_n_s16(0);
int16x8_t max = vdupq_n_s16(255);
int16x8_t y_add = vdupq_n_s16(128);
int16x8_t* y_r_buf = (int16x8_t*)y_r_buffer;
int16x8_t* cb_g_buf = (int16x8_t*)cb_g_buffer;
int16x8_t* cr_b_buf = (int16x8_t*)cr_b_buffer;
int16x8_t* y_r_buf = (int16x8_t*) y_r_buffer;
int16x8_t* cb_g_buf = (int16x8_t*) cb_g_buffer;
int16x8_t* cr_b_buf = (int16x8_t*) cr_b_buffer;
int i;
for (i = 0; i < 4096 / 8; i++)
{
int16x8_t y = vld1q_s16((INT16*)&y_r_buf[i]);
int16x8_t y = vld1q_s16((INT16*) &y_r_buf[i]);
y = vaddq_s16(y, y_add);
int16x8_t cr = vld1q_s16((INT16*)&cr_b_buf[i]);
int16x8_t cr = vld1q_s16((INT16*) &cr_b_buf[i]);
// r = between((y + cr + (cr >> 2) + (cr >> 3) + (cr >> 5)), 0, 255);
int16x8_t r = vaddq_s16(y, cr);
@ -295,50 +294,47 @@ rfx_dwt_2d_decode_block_NEON(INT16 * buffer, INT16 * idwt, int subband_width)
rfx_dwt_2d_decode_block_vert_NEON(l_dst, h_dst, buffer, subband_width);
}
void
rfx_dwt_2d_decode_NEON(INT16 * buffer, INT16 * dwt_buffer)
void rfx_dwt_2d_decode_NEON(INT16 * buffer, INT16 * dwt_buffer)
{
rfx_dwt_2d_decode_block_NEON(buffer + 3840, dwt_buffer, 8);
rfx_dwt_2d_decode_block_NEON(buffer + 3072, dwt_buffer, 16);
rfx_dwt_2d_decode_block_NEON(buffer, dwt_buffer, 32);
}
int isNeonSupported()
{
#if defined(ANDROID)
#if ANDROID
if (android_getCpuFamily() != ANDROID_CPU_FAMILY_ARM)
{
DEBUG_RFX("NEON optimization disabled - No ARM CPU found");
return 0;
}
UINT64_t features = android_getCpuFeatures();
UINT64 features = android_getCpuFeatures();
if ((features & ANDROID_CPU_ARM_FEATURE_ARMv7))
{
if (features & ANDROID_CPU_ARM_FEATURE_NEON)
{
DEBUG_RFX("NEON optimization enabled!");
return 1;
return FALSE;
}
DEBUG_RFX("NEON optimization disabled - CPU not NEON capable");
}
else
{
DEBUG_RFX("NEON optimization disabled - No ARMv7 CPU found");
}
return 0;
return FALSE;
#else
return 1;
return TRUE;
#endif
}
void rfx_init_neon(RFX_CONTEXT * context)
{
if(isNeonSupported())
if (isNeonSupported())
{
DEBUG_RFX("Using NEON optimizations");

View File

@ -114,7 +114,7 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-registry winpr-utils winpr-sspi winpr-crt)
MODULES winpr-registry winpr-utils winpr-dsparse winpr-sspi winpr-crt)
if(MONOLITHIC_BUILD)
set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE)

View File

@ -62,7 +62,7 @@
*/
/**
* Establish RDP Connection based on the settings given in the 'rdp' paremeter.
* Establish RDP Connection based on the settings given in the 'rdp' parameter.
* @msdn{cc240452}
* @param rdp RDP module
* @return true if the connection succeeded. FALSE otherwise.
@ -74,7 +74,43 @@ BOOL rdp_client_connect(rdpRdp* rdp)
nego_init(rdp->nego);
nego_set_target(rdp->nego, settings->hostname, settings->port);
nego_set_cookie(rdp->nego, settings->username);
if (settings->ts_gateway)
{
char* user;
char* domain;
char* cookie;
int user_length;
int domain_length;
int cookie_length;
user = settings->username;
user_length = strlen(settings->username);
if (settings->domain)
domain = settings->domain;
else
domain = settings->computer_name;
domain_length = strlen(domain);
cookie_length = domain_length + 1 + user_length;
cookie = (char*) malloc(cookie_length + 1);
CopyMemory(cookie, domain, domain_length);
CharUpperBuffA(cookie, domain_length);
cookie[domain_length] = '\\';
CopyMemory(&cookie[domain_length + 1], user, user_length);
cookie[cookie_length] = '\0';
nego_set_cookie(rdp->nego, cookie);
//nego_set_cookie_max_length(rdp->nego, MSTSC_COOKIE_MAX_LENGTH);
}
else
{
nego_set_cookie(rdp->nego, settings->username);
}
nego_set_send_preconnection_pdu(rdp->nego, settings->send_preconnection_pdu);
nego_set_preconnection_id(rdp->nego, settings->preconnection_id);
nego_set_preconnection_blob(rdp->nego, settings->preconnection_blob);

View File

@ -149,24 +149,6 @@ void http_request_set_auth_param(HttpRequest* http_request, char* auth_param)
http_request->AuthParam = _strdup(auth_param);
}
#ifndef _WIN32
errno_t _itoa_s(int value, char* buffer, size_t sizeInCharacters, int radix)
{
int length;
length = snprintf(NULL, 0, "%d", value);
if (sizeInCharacters < length)
return -1;
snprintf(buffer, length + 1, "%d", value);
return 0;
}
#endif
char* http_encode_body_line(char* param, char* value)
{
char* line;
@ -246,9 +228,9 @@ STREAM* http_request_write(HttpContext* http_context, HttpRequest* http_request)
for (i = 0; i < http_request->count; i++)
{
length += (strlen(http_request->lines[i]) + 1); /* add +1 for each '\n' character */
length += (strlen(http_request->lines[i]) + 2); /* add +2 for each '\r\n' character */
}
length += 1; /* empty line "\n" at end of header */
length += 2; /* empty line "\r\n" at end of header */
length += 1; /* null terminator */
s = stream_new(length);
@ -256,10 +238,10 @@ STREAM* http_request_write(HttpContext* http_context, HttpRequest* http_request)
for (i = 0; i < http_request->count; i++)
{
stream_write(s, http_request->lines[i], strlen(http_request->lines[i]));
stream_write(s, "\n", 1);
stream_write(s, "\r\n", 2);
free(http_request->lines[i]);
}
stream_write(s, "\n", 1);
stream_write(s, "\r\n", 2);
free(http_request->lines);

View File

@ -149,7 +149,7 @@ BOOL nego_connect(rdpNego* nego)
/* connect to selected security layer */
BOOL nego_security_connect(rdpNego* nego)
{
if(!nego->tcp_connected)
if (!nego->tcp_connected)
{
nego->security_connected = FALSE;
}
@ -160,7 +160,7 @@ BOOL nego_security_connect(rdpNego* nego)
DEBUG_NEGO("nego_security_connect with PROTOCOL_NLA");
nego->security_connected = transport_connect_nla(nego->transport);
}
else if (nego->selected_protocol == PROTOCOL_TLS )
else if (nego->selected_protocol == PROTOCOL_TLS)
{
DEBUG_NEGO("nego_security_connect with PROTOCOL_TLS");
nego->security_connected = transport_connect_tls(nego->transport);
@ -175,6 +175,7 @@ BOOL nego_security_connect(rdpNego* nego)
DEBUG_NEGO("cannot connect security layer because no protocol has been selected yet.");
}
}
return nego->security_connected;
}
@ -562,6 +563,7 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
STREAM* s;
int length;
BYTE *bm, *em;
int cookie_length;
s = transport_send_stream_init(nego->transport, 256);
length = TPDU_CONNECTION_REQUEST_LENGTH;
@ -575,7 +577,11 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
}
else if (nego->cookie != NULL)
{
int cookie_length = strlen(nego->cookie);
cookie_length = strlen(nego->cookie);
if (cookie_length > (int) nego->cookie_max_length)
cookie_length = nego->cookie_max_length;
stream_write(s, "Cookie: mstshash=", 17);
stream_write(s, (BYTE*) nego->cookie, cookie_length);
stream_write_BYTE(s, 0x0D); /* CR */
@ -802,6 +808,7 @@ void nego_init(rdpNego* nego)
nego->requested_protocols = PROTOCOL_RDP;
nego->transport->recv_callback = nego_recv;
nego->transport->recv_extra = (void*) nego;
nego->cookie_max_length = DEFAULT_COOKIE_MAX_LENGTH;
nego->flags = 0;
}
@ -919,6 +926,17 @@ void nego_set_cookie(rdpNego* nego, char* cookie)
nego->cookie = cookie;
}
/**
* Set cookie maximum length
* @param nego
* @param cookie_max_length
*/
void nego_set_cookie_max_length(rdpNego* nego, UINT32 cookie_max_length)
{
nego->cookie_max_length = cookie_max_length;
}
/**
* Enable / disable preconnection PDU.
* @param nego

View File

@ -65,14 +65,17 @@ enum RDP_NEG_MSG
TYPE_RDP_NEG_FAILURE = 0x3
};
#define EXTENDED_CLIENT_DATA_SUPPORTED 0x01
#define EXTENDED_CLIENT_DATA_SUPPORTED 0x01
#define PRECONNECTION_PDU_V1_SIZE 16
#define PRECONNECTION_PDU_V2_MIN_SIZE (PRECONNECTION_PDU_V1_SIZE+2)
#define PRECONNECTION_PDU_V1_SIZE 16
#define PRECONNECTION_PDU_V2_MIN_SIZE (PRECONNECTION_PDU_V1_SIZE + 2)
#define PRECONNECTION_PDU_V1 1
#define PRECONNECTION_PDU_V2 2
#define MSTSC_COOKIE_MAX_LENGTH 9
#define DEFAULT_COOKIE_MAX_LENGTH 0xFF
struct rdp_nego
{
int port;
@ -88,6 +91,7 @@ struct rdp_nego
NEGO_STATE state;
BOOL tcp_connected;
BOOL security_connected;
UINT32 cookie_max_length;
UINT32 selected_protocol;
UINT32 requested_protocols;
@ -128,6 +132,7 @@ void nego_enable_nla(rdpNego* nego, BOOL enable_nla);
void nego_enable_tls(rdpNego* nego, BOOL enable_tls);
void nego_set_routing_token(rdpNego* nego, BYTE* RoutingToken, DWORD RoutingTokenLength);
void nego_set_cookie(rdpNego* nego, char* cookie);
void nego_set_cookie_max_length(rdpNego* nego, UINT32 cookie_max_length);
void nego_set_send_preconnection_pdu(rdpNego* nego, BOOL send_pcpdu);
void nego_set_preconnection_id(rdpNego* nego, UINT32 id);
void nego_set_preconnection_blob(rdpNego* nego, char* blob);

View File

@ -27,20 +27,26 @@
#include <string.h>
#include <winpr/crt.h>
#include <winpr/tchar.h>
#include <winpr/dsparse.h>
#include <openssl/rand.h>
#include "http.h"
#include "rpc.h"
BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL confidentiality, char* user, char* domain, char* password)
/**
* The Security Support Provider Interface:
* http://technet.microsoft.com/en-us/library/bb742535/
*/
BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL http, char* user, char* domain, char* password)
{
SECURITY_STATUS status;
sspi_GlobalInit();
ntlm->confidentiality = confidentiality;
#ifdef WITH_NATIVE_SSPI
{
HMODULE hSSPI;
@ -62,6 +68,25 @@ BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL confidentiality, char* user, char* dom
sspi_SetAuthIdentity(&(ntlm->identity), user, domain, password);
if (http)
{
DWORD status;
DWORD SpnLength;
SpnLength = 0;
status = DsMakeSpn(_T("HTTP"), _T("LAB1-W2K8R2-GW.lab1.awake.local"), NULL, 0, NULL, &SpnLength, NULL);
if (status != ERROR_BUFFER_OVERFLOW)
{
_tprintf(_T("DsMakeSpn: expected ERROR_BUFFER_OVERFLOW\n"));
return -1;
}
ntlm->ServicePrincipalName = (LPTSTR) malloc(SpnLength * sizeof(TCHAR));
status = DsMakeSpn(_T("HTTP"), _T("LAB1-W2K8R2-GW.lab1.awake.local"), NULL, 0, NULL, &SpnLength, ntlm->ServicePrincipalName);
}
status = ntlm->table->QuerySecurityPackageInfo(NTLMSP_NAME, &ntlm->pPackageInfo);
if (status != SEC_E_OK)
@ -87,10 +112,60 @@ BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL confidentiality, char* user, char* dom
ZeroMemory(&ntlm->outputBuffer, sizeof(SecBuffer));
ZeroMemory(&ntlm->ContextSizes, sizeof(SecPkgContext_Sizes));
ntlm->fContextReq = ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT | ISC_REQ_DELEGATE;
ntlm->fContextReq = 0;
if (ntlm->confidentiality)
if (http)
{
/* flags for HTTP authentication */
ntlm->fContextReq |= ISC_REQ_CONFIDENTIALITY;
}
else
{
/**
* flags for RPC authentication:
* RPC_C_AUTHN_LEVEL_PKT_INTEGRITY:
* ISC_REQ_USE_DCE_STYLE | ISC_REQ_DELEGATE | ISC_REQ_MUTUAL_AUTH |
* ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT
*/
ntlm->fContextReq |= ISC_REQ_USE_DCE_STYLE;
ntlm->fContextReq |= ISC_REQ_DELEGATE | ISC_REQ_MUTUAL_AUTH;
ntlm->fContextReq |= ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT;
}
return TRUE;
}
BOOL ntlm_client_make_spn(rdpNtlm* ntlm, LPCTSTR ServiceClass, char* hostname)
{
int length;
DWORD status;
DWORD SpnLength;
LPTSTR hostnameX;
length = 0;
#ifdef UNICODE
length = strlen(hostname);
hostnameX = (LPWSTR) malloc(length * sizeof(TCHAR));
MultiByteToWideChar(CP_ACP, 0, hostname, length, hostnameX, length);
hostnameX[length] = 0;
#else
hostnameX = hostname;
#endif
SpnLength = 0;
status = DsMakeSpn(ServiceClass, hostnameX, NULL, 0, NULL, &SpnLength, NULL);
if (status != ERROR_BUFFER_OVERFLOW)
return FALSE;
ntlm->ServicePrincipalName = (LPTSTR) malloc(SpnLength * sizeof(TCHAR));
status = DsMakeSpn(ServiceClass, hostnameX, NULL, 0, NULL, &SpnLength, ntlm->ServicePrincipalName);
if (status != ERROR_SUCCESS)
return -1;
return TRUE;
}
@ -116,7 +191,8 @@ BOOL ntlm_authenticate(rdpNtlm* ntlm)
status = ntlm->table->InitializeSecurityContext(&ntlm->credentials,
(ntlm->haveContext) ? &ntlm->context : NULL,
NULL, ntlm->fContextReq, 0, SECURITY_NATIVE_DREP,
(ntlm->ServicePrincipalName) ? ntlm->ServicePrincipalName : NULL,
ntlm->fContextReq, 0, SECURITY_NATIVE_DREP,
(ntlm->haveInputBuffer) ? &ntlm->inputBufferDesc : NULL,
0, &ntlm->context, &ntlm->outputBufferDesc,
&ntlm->pfContextAttr, &ntlm->expiration);
@ -212,13 +288,26 @@ STREAM* rpc_ntlm_http_request(rdpRpc* rpc, SecBuffer* ntlm_token, int content_le
BOOL rpc_ntlm_http_out_connect(rdpRpc* rpc)
{
STREAM* s;
rdpSettings* settings;
int ntlm_token_length;
BYTE* ntlm_token_data;
HttpResponse* http_response;
rdpNtlm* ntlm = rpc->ntlm_http_out->ntlm;
ntlm_client_init(ntlm, TRUE, rpc->settings->username,
rpc->settings->domain, rpc->settings->password);
settings = rpc->settings;
if (settings->tsg_same_credentials)
{
ntlm_client_init(ntlm, TRUE, settings->username,
settings->domain, settings->password);
ntlm_client_make_spn(ntlm, _T("HTTP"), settings->tsg_hostname);
}
else
{
ntlm_client_init(ntlm, TRUE, settings->tsg_username,
settings->tsg_domain, settings->tsg_password);
ntlm_client_make_spn(ntlm, _T("HTTP"), settings->tsg_hostname);
}
ntlm_authenticate(ntlm);
@ -262,13 +351,26 @@ BOOL rpc_ntlm_http_out_connect(rdpRpc* rpc)
BOOL rpc_ntlm_http_in_connect(rdpRpc* rpc)
{
STREAM* s;
rdpSettings* settings;
int ntlm_token_length;
BYTE* ntlm_token_data;
HttpResponse* http_response;
rdpNtlm* ntlm = rpc->ntlm_http_in->ntlm;
ntlm_client_init(ntlm, TRUE, rpc->settings->username,
rpc->settings->domain, rpc->settings->password);
settings = rpc->settings;
if (settings->tsg_same_credentials)
{
ntlm_client_init(ntlm, TRUE, settings->username,
settings->domain, settings->password);
ntlm_client_make_spn(ntlm, _T("HTTP"), settings->tsg_hostname);
}
else
{
ntlm_client_init(ntlm, TRUE, settings->tsg_username,
settings->tsg_domain, settings->tsg_password);
ntlm_client_make_spn(ntlm, _T("HTTP"), settings->tsg_hostname);
}
ntlm_authenticate(ntlm);

View File

@ -540,6 +540,7 @@ struct rdp_ntlm
SecBuffer outputBuffer;
BOOL haveContext;
BOOL haveInputBuffer;
LPTSTR ServicePrincipalName;
SecBufferDesc inputBufferDesc;
SecBufferDesc outputBufferDesc;
CredHandle credentials;

View File

@ -31,6 +31,7 @@
#endif
#include <winpr/crt.h>
#include <winpr/sysinfo.h>
#include <winpr/registry.h>
#include <freerdp/settings.h>
@ -184,6 +185,15 @@ void settings_load_hkey_local_machine(rdpSettings* settings)
settings_client_load_hkey_local_machine(settings);
}
void settings_get_computer_name(rdpSettings* settings)
{
DWORD nSize = 0;
GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize);
settings->computer_name = (char*) malloc(nSize);
GetComputerNameExA(ComputerNameNetBIOS, settings->computer_name, &nSize);
}
rdpSettings* settings_new(void* instance)
{
rdpSettings* settings;
@ -235,6 +245,8 @@ rdpSettings* settings_new(void* instance)
settings->authentication_only = FALSE;
settings->from_stdin = FALSE;
settings_get_computer_name(settings);
settings->received_caps = xzalloc(32);
settings->order_support = xzalloc(32);

View File

@ -100,16 +100,31 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
while (index < argc)
{
if (index == 1)
{
p = strstr(argv[index], ".rdp");
if (!p)
p = strstr(argv[index], ".RDP");
if (p)
{
settings->connection_file = _strdup(argv[index]);
index++;
continue;
}
}
if ((strcmp("-h", argv[index]) == 0 ) || (strcmp("--help", argv[index]) == 0 ))
{
printf("\n"
"FreeRDP - A Free Remote Desktop Protocol Client\n"
"See http://www.freerdp.com for more information\n"
"\n"
"Usage: %s [options] server:port\n"
"Usage: %s [file] [options] server:port\n"
" -0: connect to console session\n"
" -a: set color depth in bit, default is 16\n"
" -c: initial working directory\n"
" -c: shell working directory\n"
" -D: hide window decorations\n"
" -T: window title\n"
" -d: domain\n"
@ -935,7 +950,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
}
/* Must have a hostname. Do you? */
if (NULL == settings->hostname)
if ((settings->hostname == NULL) && (settings->connection_file == NULL))
{
printf("missing server name\n");
return FREERDP_ARGS_PARSE_FAILURE;
@ -944,5 +959,4 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
{
return index;
}
}

View File

@ -18,7 +18,6 @@
* limitations under the License.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -26,18 +25,17 @@
#include <freerdp/utils/debug.h>
#include <freerdp/utils/msusb.h>
static MSUSB_PIPE_DESCRIPTOR *
msusb_mspipe_new()
static MSUSB_PIPE_DESCRIPTOR* msusb_mspipe_new()
{
MSUSB_PIPE_DESCRIPTOR * MsPipe = (MSUSB_PIPE_DESCRIPTOR *)malloc(sizeof(MSUSB_PIPE_DESCRIPTOR));
MSUSB_PIPE_DESCRIPTOR* MsPipe = (MSUSB_PIPE_DESCRIPTOR*) malloc(sizeof(MSUSB_PIPE_DESCRIPTOR));
memset(MsPipe, 0, sizeof(MSUSB_PIPE_DESCRIPTOR));
return MsPipe;
}
static void
msusb_mspipes_free(MSUSB_PIPE_DESCRIPTOR ** MsPipes, UINT32 NumberOfPipes)
static void msusb_mspipes_free(MSUSB_PIPE_DESCRIPTOR** MsPipes, UINT32 NumberOfPipes)
{
int pnum = 0;
if (MsPipes)
{
for (pnum = 0; pnum < NumberOfPipes && MsPipes[pnum]; pnum++)
@ -48,27 +46,23 @@ msusb_mspipes_free(MSUSB_PIPE_DESCRIPTOR ** MsPipes, UINT32 NumberOfPipes)
}
}
void
msusb_mspipes_replace(MSUSB_INTERFACE_DESCRIPTOR * MsInterface, MSUSB_PIPE_DESCRIPTOR ** NewMsPipes, UINT32 NewNumberOfPipes)
void msusb_mspipes_replace(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, MSUSB_PIPE_DESCRIPTOR** NewMsPipes, UINT32 NewNumberOfPipes)
{
/* free orignal MsPipes */
msusb_mspipes_free(MsInterface->MsPipes, MsInterface->NumberOfPipes);
/* And replace it */
MsInterface->MsPipes = NewMsPipes;
MsInterface->NumberOfPipes = NewNumberOfPipes;
}
static MSUSB_PIPE_DESCRIPTOR **
msusb_mspipes_read(BYTE * data, UINT32 data_size, UINT32 NumberOfPipes, int * offset)
static MSUSB_PIPE_DESCRIPTOR** msusb_mspipes_read(BYTE* data, UINT32 data_size, UINT32 NumberOfPipes, int* offset)
{
MSUSB_PIPE_DESCRIPTOR ** MsPipes;
int pnum, move = 0;
MSUSB_PIPE_DESCRIPTOR** MsPipes;
MsPipes = (MSUSB_PIPE_DESCRIPTOR **)malloc(NumberOfPipes *
sizeof(MSUSB_PIPE_DESCRIPTOR *));
MsPipes = (MSUSB_PIPE_DESCRIPTOR**) malloc(NumberOfPipes * sizeof(MSUSB_PIPE_DESCRIPTOR*));
for(pnum = 0;pnum < NumberOfPipes; pnum++)
for (pnum = 0; pnum < NumberOfPipes; pnum++)
{
MSUSB_PIPE_DESCRIPTOR * MsPipe = msusb_mspipe_new();
@ -91,16 +85,14 @@ msusb_mspipes_read(BYTE * data, UINT32 data_size, UINT32 NumberOfPipes, int * of
return MsPipes;
}
static MSUSB_INTERFACE_DESCRIPTOR *
msusb_msinterface_new()
static MSUSB_INTERFACE_DESCRIPTOR* msusb_msinterface_new()
{
MSUSB_INTERFACE_DESCRIPTOR * MsInterface = (MSUSB_INTERFACE_DESCRIPTOR *)malloc(sizeof(MSUSB_INTERFACE_DESCRIPTOR));
MSUSB_INTERFACE_DESCRIPTOR* MsInterface = (MSUSB_INTERFACE_DESCRIPTOR*) malloc(sizeof(MSUSB_INTERFACE_DESCRIPTOR));
memset(MsInterface, 0, sizeof(MSUSB_INTERFACE_DESCRIPTOR));
return MsInterface;
}
static void
msusb_msinterface_free(MSUSB_INTERFACE_DESCRIPTOR * MsInterface)
static void msusb_msinterface_free(MSUSB_INTERFACE_DESCRIPTOR* MsInterface)
{
if (MsInterface)
{
@ -110,8 +102,7 @@ msusb_msinterface_free(MSUSB_INTERFACE_DESCRIPTOR * MsInterface)
}
}
static void
msusb_msinterface_free_list(MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces, UINT32 NumInterfaces)
static void msusb_msinterface_free_list(MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces, UINT32 NumInterfaces)
{
int inum = 0;
@ -121,21 +112,20 @@ msusb_msinterface_free_list(MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces, UINT32 N
{
msusb_msinterface_free(MsInterfaces[inum]);
}
zfree(MsInterfaces);
}
}
void
msusb_msinterface_replace(MSUSB_CONFIG_DESCRIPTOR * MsConfig, BYTE InterfaceNumber, MSUSB_INTERFACE_DESCRIPTOR * NewMsInterface)
void msusb_msinterface_replace(MSUSB_CONFIG_DESCRIPTOR* MsConfig, BYTE InterfaceNumber, MSUSB_INTERFACE_DESCRIPTOR* NewMsInterface)
{
msusb_msinterface_free(MsConfig->MsInterfaces[InterfaceNumber]);
MsConfig->MsInterfaces[InterfaceNumber] = NewMsInterface;
}
MSUSB_INTERFACE_DESCRIPTOR *
msusb_msinterface_read(BYTE * data, UINT32 data_size, int * offset)
MSUSB_INTERFACE_DESCRIPTOR* msusb_msinterface_read(BYTE* data, UINT32 data_size, int* offset)
{
MSUSB_INTERFACE_DESCRIPTOR * MsInterface;
MSUSB_INTERFACE_DESCRIPTOR* MsInterface;
MsInterface = msusb_msinterface_new();
@ -146,12 +136,12 @@ msusb_msinterface_read(BYTE * data, UINT32 data_size, int * offset)
data_read_UINT32(data + 8, MsInterface->NumberOfPipes);
*offset += 12;
MsInterface->InterfaceHandle = 0;
MsInterface->bInterfaceClass = 0;
MsInterface->InterfaceHandle = 0;
MsInterface->bInterfaceClass = 0;
MsInterface->bInterfaceSubClass = 0;
MsInterface->bInterfaceProtocol = 0;
MsInterface->InitCompleted = 0;
MsInterface->MsPipes = NULL;
MsInterface->InitCompleted = 0;
MsInterface->MsPipes = NULL;
if (MsInterface->NumberOfPipes > 0)
{
@ -162,8 +152,7 @@ msusb_msinterface_read(BYTE * data, UINT32 data_size, int * offset)
return MsInterface;
}
int
msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR * MsInterface, BYTE * data, int * offset)
int msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, BYTE* data, int* offset)
{
MSUSB_PIPE_DESCRIPTOR ** MsPipes;
MSUSB_PIPE_DESCRIPTOR * MsPipe;
@ -216,38 +205,38 @@ msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR * MsInterface, BYTE * data, i
return 0;
}
static MSUSB_INTERFACE_DESCRIPTOR **
msusb_msinterface_read_list(BYTE * data, UINT32 data_size, UINT32 NumInterfaces)
static MSUSB_INTERFACE_DESCRIPTOR** msusb_msinterface_read_list(BYTE * data, UINT32 data_size, UINT32 NumInterfaces)
{
MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces;
int inum, offset = 0;
MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces;
MsInterfaces = (MSUSB_INTERFACE_DESCRIPTOR **)malloc(NumInterfaces *
sizeof(MSUSB_INTERFACE_DESCRIPTOR *));
MsInterfaces = (MSUSB_INTERFACE_DESCRIPTOR**) malloc(NumInterfaces * sizeof(MSUSB_INTERFACE_DESCRIPTOR*));
for(inum = 0; inum < NumInterfaces; inum++)
for (inum = 0; inum < NumInterfaces; inum++)
{
MsInterfaces[inum] = msusb_msinterface_read(data + offset, data_size - offset, &offset);
}
return MsInterfaces;
}
int
msusb_msconfig_write(MSUSB_CONFIG_DESCRIPTOR * MsConfg, BYTE * data, int * offset)
int msusb_msconfig_write(MSUSB_CONFIG_DESCRIPTOR* MsConfg, BYTE* data, int* offset)
{
MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces;
MSUSB_INTERFACE_DESCRIPTOR * MsInterface;
int inum = 0;
MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces;
MSUSB_INTERFACE_DESCRIPTOR* MsInterface;
/* ConfigurationHandle*/
data_write_UINT32(data + *offset, MsConfg->ConfigurationHandle);
data_write_UINT32(data + *offset, MsConfg->ConfigurationHandle);
/* NumInterfaces*/
data_write_UINT32(data + *offset + 4, MsConfg->NumInterfaces);
*offset += 8;
/* Interfaces */
MsInterfaces = MsConfg->MsInterfaces;
for(inum = 0; inum < MsConfg->NumInterfaces; inum++)
{
MsInterface = MsInterfaces[inum];
@ -257,18 +246,16 @@ msusb_msconfig_write(MSUSB_CONFIG_DESCRIPTOR * MsConfg, BYTE * data, int * offse
return 0;
}
MSUSB_CONFIG_DESCRIPTOR *
msusb_msconfig_new()
MSUSB_CONFIG_DESCRIPTOR* msusb_msconfig_new()
{
MSUSB_CONFIG_DESCRIPTOR * MsConfig = NULL;
MsConfig = (MSUSB_CONFIG_DESCRIPTOR *)malloc(sizeof(MSUSB_CONFIG_DESCRIPTOR));
MSUSB_CONFIG_DESCRIPTOR* MsConfig = NULL;
MsConfig = (MSUSB_CONFIG_DESCRIPTOR*) malloc(sizeof(MSUSB_CONFIG_DESCRIPTOR));
memset(MsConfig, 0, sizeof(MSUSB_CONFIG_DESCRIPTOR));
return MsConfig;
}
void
msusb_msconfig_free(MSUSB_CONFIG_DESCRIPTOR * MsConfig)
void msusb_msconfig_free(MSUSB_CONFIG_DESCRIPTOR* MsConfig)
{
if (MsConfig)
{
@ -278,13 +265,12 @@ msusb_msconfig_free(MSUSB_CONFIG_DESCRIPTOR * MsConfig)
}
}
MSUSB_CONFIG_DESCRIPTOR *
msusb_msconfig_read(BYTE * data, UINT32 data_size, UINT32 NumInterfaces)
MSUSB_CONFIG_DESCRIPTOR* msusb_msconfig_read(BYTE* data, UINT32 data_size, UINT32 NumInterfaces)
{
MSUSB_CONFIG_DESCRIPTOR * MsConfig;
BYTE lenConfiguration, typeConfiguration;
UINT16 lenInterface;
int i, offset = 0;
UINT16 lenInterface;
MSUSB_CONFIG_DESCRIPTOR* MsConfig;
BYTE lenConfiguration, typeConfiguration;
MsConfig = msusb_msconfig_new();
@ -293,34 +279,35 @@ msusb_msconfig_read(BYTE * data, UINT32 data_size, UINT32 NumInterfaces)
data_read_UINT16(data + offset, lenInterface);
offset += lenInterface;
}
data_read_BYTE(data + offset, lenConfiguration);
data_read_BYTE(data + offset + 1, typeConfiguration);
if (lenConfiguration != 0x9 || typeConfiguration != 0x2)
{
DEBUG("%s: len and type must be 0x9 and 0x2 , but it is 0x%x and 0x%x",
lenConfiguration, typeConfiguration);
}
data_read_UINT16(data + offset + 2, MsConfig->wTotalLength);
data_read_BYTE(data + offset + 5, MsConfig->bConfigurationValue);
MsConfig->NumInterfaces = NumInterfaces;
MsConfig->NumInterfaces = NumInterfaces;
MsConfig->ConfigurationHandle = 0;
MsConfig->InitCompleted = 0;
MsConfig->MsOutSize = 0;
MsConfig->MsInterfaces = NULL;
MsConfig->InitCompleted = 0;
MsConfig->MsOutSize = 0;
MsConfig->MsInterfaces = NULL;
offset = 0;
if (NumInterfaces > 0)
{
MsConfig->MsInterfaces =
msusb_msinterface_read_list(data, data_size, NumInterfaces);
MsConfig->MsInterfaces = msusb_msinterface_read_list(data, data_size, NumInterfaces);
}
return MsConfig;
}
void
msusb_msconfig_dump(MSUSB_CONFIG_DESCRIPTOR * MsConfig)
void msusb_msconfig_dump(MSUSB_CONFIG_DESCRIPTOR* MsConfig)
{
MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces;
MSUSB_INTERFACE_DESCRIPTOR * MsInterface;

View File

@ -50,6 +50,10 @@ WINPR_API size_t _aligned_msize(void* memblock, size_t alignment, size_t offset)
WINPR_API void _aligned_free(void* memblock);
/* Data Conversion */
WINPR_API errno_t _itoa_s(int value, char* buffer, size_t sizeInCharacters, int radix);
/* Buffer Manipulation */
WINPR_API errno_t memmove_s(void* dest, size_t numberOfElements, const void* src, size_t count);

View File

@ -22,13 +22,76 @@
#ifdef _WIN32
#include <winpr/rpc.h>
#include <winpr/windows.h>
#include <ntdsapi.h>
#else
#include <winpr/crt.h>
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#include <winpr/error.h>
typedef enum
{
DS_NAME_NO_FLAGS = 0x0,
DS_NAME_FLAG_SYNTACTICAL_ONLY = 0x1,
DS_NAME_FLAG_EVAL_AT_DC = 0x2,
DS_NAME_FLAG_GCVERIFY = 0x4,
DS_NAME_FLAG_TRUST_REFERRAL = 0x8
} DS_NAME_FLAGS;
typedef enum
{
DS_UNKNOWN_NAME = 0,
DS_FQDN_1779_NAME = 1,
DS_NT4_ACCOUNT_NAME = 2,
DS_DISPLAY_NAME = 3,
DS_UNIQUE_ID_NAME = 6,
DS_CANONICAL_NAME = 7,
DS_USER_PRINCIPAL_NAME = 8,
DS_CANONICAL_NAME_EX = 9,
DS_SERVICE_PRINCIPAL_NAME = 10,
DS_SID_OR_SID_HISTORY_NAME = 11,
DS_DNS_DOMAIN_NAME = 12
} DS_NAME_FORMAT;
typedef enum
{
DS_NAME_NO_ERROR = 0,
DS_NAME_ERROR_RESOLVING = 1,
DS_NAME_ERROR_NOT_FOUND = 2,
DS_NAME_ERROR_NOT_UNIQUE = 3,
DS_NAME_ERROR_NO_MAPPING = 4,
DS_NAME_ERROR_DOMAIN_ONLY = 5,
DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 6,
DS_NAME_ERROR_TRUST_REFERRAL = 7
} DS_NAME_ERROR;
typedef enum
{
DS_SPN_DNS_HOST = 0,
DS_SPN_DN_HOST = 1,
DS_SPN_NB_HOST = 2,
DS_SPN_DOMAIN = 3,
DS_SPN_NB_DOMAIN = 4,
DS_SPN_SERVICE = 5
} DS_SPN_NAME_TYPE;
typedef struct
{
DWORD status;
LPTSTR pDomain;
LPTSTR pName;
} DS_NAME_RESULT_ITEM, *PDS_NAME_RESULT_ITEM;
typedef struct
{
DWORD cItems;
PDS_NAME_RESULT_ITEM rItems;
} DS_NAME_RESULT, *PDS_NAME_RESULT;
WINPR_API DWORD DsCrackSpnW(LPCWSTR pszSpn, DWORD* pcServiceClass, LPWSTR ServiceClass, DWORD* pcServiceName,
LPWSTR ServiceName, DWORD* pcInstanceName, LPWSTR InstanceName, USHORT* pInstancePort);

View File

@ -22,7 +22,11 @@
#include <winpr/rpc.h>
#ifndef _WIN32
WINPR_API void* MIDL_user_allocate(size_t cBytes);
WINPR_API void MIDL_user_free(void* p);
#endif
#endif /* WINPR_RPC_MIDL_H */

View File

@ -23,6 +23,8 @@
#include <winpr/rpc.h>
#include <winpr/wtypes.h>
#ifndef _WIN32
#define __RPC_WIN32__ 1
#define TARGET_IS_NT50_OR_LATER 1
@ -525,4 +527,6 @@ typedef void (*NDR_TYPE_FREE_ROUTINE)(PMIDL_STUB_MESSAGE pStubMsg, unsigned char
WINPR_API CLIENT_CALL_RETURN NdrClientCall2(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ...);
#endif
#endif /* WINPR_RPC_NDR_H */

View File

@ -20,6 +20,12 @@
#ifndef WINPR_RPC_H
#define WINPR_RPC_H
#ifdef _WIN32
#include <rpc.h>
#else
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
@ -42,4 +48,6 @@ typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_SERIALIZE;
void RpcRaiseException(RPC_STATUS exception);
#endif
#endif /* WINPR_RPC_H */

View File

@ -49,7 +49,13 @@ WINPR_API WCHAR* _wcsdup(const WCHAR* strSource);
WINPR_API int _stricmp(const char* string1, const char* string2);
WINPR_API int _wcscmp(const WCHAR* string1, const WCHAR* string2);
WINPR_API size_t _wcslen(const WCHAR* str);
WINPR_API WCHAR* _wcschr(const WCHAR* str, WCHAR c);
WINPR_API char* strtok_s(char* strToken, const char* strDelimit, char** context);
WINPR_API WCHAR* wcstok_s(WCHAR* strToken, const WCHAR* strDelimit, WCHAR** context);
WINPR_API LPSTR CharUpperA(LPSTR lpsz);
WINPR_API LPWSTR CharUpperW(LPWSTR lpsz);
@ -149,6 +155,12 @@ WINPR_API int lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2);
#define sprintf_s snprintf
#else
#define _wcscmp wcscmp
#define _wcslen wcslen
#define _wcschr wcschr
#endif
#endif /* WINPR_CRT_STRING_H */

View File

@ -20,6 +20,7 @@ set(MODULE_PREFIX "WINPR_CRT")
set(${MODULE_PREFIX}_SRCS
alignment.c
conversion.c
buffer.c
memory.c
string.c)

View File

@ -0,0 +1,45 @@
/**
* WinPR: Windows Portable Runtime
* Data Conversion
*
* 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/crt.h>
/* Data Conversion: http://msdn.microsoft.com/en-us/library/0heszx3w/ */
#ifndef _WIN32
errno_t _itoa_s(int value, char* buffer, size_t sizeInCharacters, int radix)
{
int length;
length = snprintf(NULL, 0, "%d", value);
if (sizeInCharacters < length)
return -1;
snprintf(buffer, length + 1, "%d", value);
return 0;
}
#endif

View File

@ -74,11 +74,74 @@ int _stricmp(const char* string1, const char* string2)
return strcasecmp(string1, string2);
}
/* _wcscmp -> wcscmp */
int _wcscmp(const WCHAR* string1, const WCHAR* string2)
{
while (*string1 && (*string1 == *string2))
{
string1++;
string2++;
}
return *string1 - *string2;
}
/* _wcslen -> wcslen */
size_t _wcslen(const WCHAR* str)
{
WCHAR* p = (WCHAR*) str;
while (*p)
p++;
return (p - str);
}
/* _wcschr -> wcschr */
WCHAR* _wcschr(const WCHAR* str, WCHAR c)
{
WCHAR* p = (WCHAR*) str;
while (*p && (*p != c))
p++;
return ((*p == c) ? p : NULL);
}
char* strtok_s(char* strToken, const char* strDelimit, char** context)
{
return strtok_r(strToken, strDelimit, context);
}
WCHAR* wcstok_s(WCHAR* strToken, const WCHAR* strDelimit, WCHAR** context)
{
WCHAR* nextToken;
if (!strToken)
strToken = *context;
while (*strToken && _wcschr(strDelimit, *strToken))
strToken++;
if (!*strToken)
return NULL;
nextToken = strToken++;
while (*strToken && !(_wcschr(strDelimit, *strToken)))
strToken++;
if (*strToken)
*strToken++ = 0;
*context = strToken;
return nextToken;
}
/* Windows API Sets - api-ms-win-core-string-l2-1-0.dll
* http://msdn.microsoft.com/en-us/library/hh802935/
*/

View File

@ -5,7 +5,8 @@ set(MODULE_PREFIX "TEST_CRT")
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestAlignment.c)
TestAlignment.c
TestString.c)
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}

View File

@ -1,6 +1,5 @@
#include <stdio.h>
#include <malloc.h>
#include <winpr/crt.h>
#include <winpr/windows.h>

View File

@ -0,0 +1,109 @@
#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/windows.h>
static WCHAR testStringW[] =
{
'T', 'h', 'e', ' ', 'q', 'u', 'i', 'c', 'k', ' ', 'b', 'r', 'o', 'w', 'n', ' ',
'f', 'o', 'x', ' ', 'j', 'u', 'm', 'p', 's', ' ', 'o', 'v', 'e', 'r', ' ',
't', 'h', 'e', ' ', 'l', 'a', 'z', 'y', ' ', 'd', 'o', 'g', '\0'
};
#define testStringW_Length ((sizeof(testStringW) / sizeof(WCHAR)) - 1)
static WCHAR testToken1W[] = { 'q', 'u', 'i', 'c', 'k', '\0' };
static WCHAR testToken2W[] = { 'b', 'r', 'o', 'w', 'n', '\0' };
static WCHAR testToken3W[] = { 'f', 'o', 'x', '\0' };
static WCHAR testTokensW[] =
{
'q', 'u', 'i', 'c', 'k', '\r', '\n',
'b', 'r', 'o', 'w', 'n', '\r', '\n',
'f', 'o', 'x', '\r', '\n', '\0'
};
static WCHAR testDelimiter[] = { '\r', '\n', '\0' };
int TestString(int argc, char* argv[])
{
WCHAR* p;
size_t pos;
size_t length;
WCHAR* context;
/* _wcslen */
length = _wcslen(testStringW);
if (length != testStringW_Length)
{
printf("_wcslen error: length mismatch: Actual: %d, Expected: %d\n", length, testStringW_Length);
return -1;
}
/* _wcschr */
p = _wcschr(testStringW, 'r');
pos = (p - testStringW);
if (pos != 11)
{
printf("_wcschr error: position mismatch: Actual: %d, Expected: %d\n", pos, 11);
return -1;
}
p = _wcschr(&testStringW[pos + 1], 'r');
pos = (p - testStringW);
if (pos != 29)
{
printf("_wcschr error: position mismatch: Actual: %d, Expected: %d\n", pos, 29);
return -1;
}
p = _wcschr(&testStringW[pos + 1], 'r');
if (p != NULL)
{
printf("_wcschr error: return value mismatch: Actual: 0x%08X, Expected: 0x%08X\n", (size_t) p, (size_t) NULL);
return -1;
}
/* wcstok_s */
p = wcstok_s(testTokensW, testDelimiter, &context);
if (memcmp(p, testToken1W, sizeof(testToken1W)) != 0)
{
printf("wcstok_s error: token #1 mismatch\n");
return -1;
}
p = wcstok_s(NULL, testDelimiter, &context);
if (memcmp(p, testToken2W, sizeof(testToken2W)) != 0)
{
printf("wcstok_s error: token #2 mismatch\n");
return -1;
}
p = wcstok_s(NULL, testDelimiter, &context);
if (memcmp(p, testToken3W, sizeof(testToken3W)) != 0)
{
printf("wcstok_s error: token #3 mismatch\n");
return -1;
}
p = wcstok_s(NULL, testDelimiter, &context);
if (p != NULL)
{
printf("wcstok_s error: return value is not NULL\n");
return -1;
}
return 0;
}

View File

@ -21,16 +21,29 @@ set(MODULE_PREFIX "WINPR_DSPARSE")
set(${MODULE_PREFIX}_SRCS
dsparse.c)
if(MSVC AND (NOT MONOLITHIC_BUILD))
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
endif()
add_complex_library(MODULE ${MODULE_NAME} TYPE "OBJECT"
MONOLITHIC ${MONOLITHIC_BUILD}
SOURCES ${${MODULE_PREFIX}_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib")
if(MONOLITHIC_BUILD)
if(WIN32)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ntdsapi)
endif()
if(MONOLITHIC_BUILD)
set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE)
else()
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR")
if(BUILD_TESTING)
add_subdirectory(test)
endif()

View File

@ -66,7 +66,27 @@ DWORD DsMakeSpnW(LPCWSTR ServiceClass, LPCWSTR ServiceName, LPCWSTR InstanceName
DWORD DsMakeSpnA(LPCSTR ServiceClass, LPCSTR ServiceName, LPCSTR InstanceName,
USHORT InstancePort, LPCSTR Referrer, DWORD* pcSpnLength, LPSTR pszSpn)
{
return 0;
DWORD SpnLength;
DWORD ServiceClassLength;
DWORD ServiceNameLength;
if ((*pcSpnLength != 0) && (pszSpn == NULL))
return ERROR_INVALID_PARAMETER;
ServiceClassLength = strlen(ServiceClass);
ServiceNameLength = strlen(ServiceName);
SpnLength = ServiceClassLength + 1 + ServiceNameLength + 1;
if ((*pcSpnLength == 0) || (*pcSpnLength < SpnLength))
{
*pcSpnLength = SpnLength;
return ERROR_BUFFER_OVERFLOW;
}
sprintf_s(pszSpn, *pcSpnLength, "%s/%s", ServiceClass, ServiceName);
return ERROR_SUCCESS;
}
#endif

View File

@ -0,0 +1,3 @@
LIBRARY "libwinpr-dsparse"
EXPORTS

View File

@ -0,0 +1,2 @@
TestDs
TestDs.c

View File

@ -0,0 +1,31 @@
set(MODULE_NAME "TestDsParse")
set(MODULE_PREFIX "TEST_DSPARSE")
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestDsMakeSpn.c
TestDsCrackNames.c)
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
${${MODULE_PREFIX}_TESTS})
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-dsparse)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
foreach(test ${${MODULE_PREFIX}_TESTS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
endforeach()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")

View File

@ -0,0 +1,50 @@
#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/winpr.h>
#include <winpr/tchar.h>
#include <winpr/dsparse.h>
//LPCTSTR testName = _T("LAB1\\JohnDoe");
int TestDsCrackNames(int argc, char* argv[])
{
#if 0
HANDLE ds;
DWORD status;
PDS_NAME_RESULT pResult;
status = DsBind(NULL, NULL, &ds);
if (status != ERROR_SUCCESS)
{
_tprintf(_T("DsBind: expected ERROR_SUCCESS: 0x%08X\n"), status);
return -1;
}
status = DsCrackNames(ds, DS_NAME_FLAG_SYNTACTICAL_ONLY, DS_NT4_ACCOUNT_NAME,
DS_USER_PRINCIPAL_NAME, 1, &testName, &pResult);
if (status != ERROR_SUCCESS)
{
_tprintf(_T("DsCrackNames: expected ERROR_SUCCESS\n"));
return -1;
}
_tprintf(_T("DsCrackNames: pResult->cItems: %d\n"), pResult->cItems);
_tprintf(_T("DsCrackNames: pResult->rItems[0]: Domain: %s Name: %s Status: 0x%08X\n"),
pResult->rItems[0].pDomain, pResult->rItems[0].pName, pResult->rItems[0].status);
status = DsUnBind(&ds);
if (status != ERROR_SUCCESS)
{
_tprintf(_T("DsUnBind: expected ERROR_SUCCESS\n"));
return -1;
}
#endif
return 0;
}

View File

@ -0,0 +1,63 @@
#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/winpr.h>
#include <winpr/tchar.h>
#include <winpr/dsparse.h>
LPCTSTR testServiceClass = _T("HTTP");
LPCTSTR testServiceName = _T("LAB1-W2K8R2-GW.lab1.awake.local");
LPCTSTR testSpn = _T("HTTP/LAB1-W2K8R2-GW.lab1.awake.local");
int TestDsMakeSpn(int argc, char* argv[])
{
LPTSTR Spn;
DWORD status;
DWORD SpnLength;
SpnLength = -1;
status = DsMakeSpn(testServiceClass, testServiceName, NULL, 0, NULL, &SpnLength, NULL);
if (status != ERROR_INVALID_PARAMETER)
{
_tprintf(_T("DsMakeSpn: expected ERROR_INVALID_PARAMETER\n"));
return -1;
}
SpnLength = 0;
status = DsMakeSpn(testServiceClass, testServiceName, NULL, 0, NULL, &SpnLength, NULL);
if (status != ERROR_BUFFER_OVERFLOW)
{
_tprintf(_T("DsMakeSpn: expected ERROR_BUFFER_OVERFLOW\n"));
return -1;
}
if (SpnLength != 37)
{
_tprintf(_T("DsMakeSpn: SpnLength mismatch: Actual: %d, Expected: %d\n"), SpnLength, 37);
return -1;
}
/* SpnLength includes null terminator */
Spn = (LPTSTR) malloc(SpnLength * sizeof(TCHAR));
status = DsMakeSpn(testServiceClass, testServiceName, NULL, 0, NULL, &SpnLength, Spn);
if (status != ERROR_SUCCESS)
{
_tprintf(_T("DsMakeSpn: expected ERROR_SUCCESS\n"));
return -1;
}
if (_tcscmp(Spn, testSpn) != 0)
{
_tprintf(_T("DsMakeSpn: SPN mismatch: Actual: %s, Expected: %s\n"), Spn, testSpn);
return -1;
}
_tprintf(_T("DsMakeSpn: %s\n"), Spn);
return 0;
}

View File

@ -7,7 +7,8 @@
/* Forward declare test functions. */
int TestIoGetOverlappedResult(int, char*[]);
int TestDsMakeSpn(int, char*[]);
int TestDsCrackNames(int, char*[]);
/* Create map. */
@ -21,8 +22,12 @@ typedef struct
functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
{
"TestIoGetOverlappedResult",
TestIoGetOverlappedResult
"TestDsMakeSpn",
TestDsMakeSpn
},
{
"TestDsCrackNames",
TestDsCrackNames
},
{0,0}

View File

@ -1,6 +1,5 @@
#include <stdio.h>
#include <malloc.h>
#include <winpr/crt.h>
#include <winpr/windows.h>
#include <winpr/interlocked.h>

View File

@ -1,6 +1,5 @@
#include <stdio.h>
#include <malloc.h>
#include <winpr/crt.h>
#include <winpr/windows.h>
#include <winpr/interlocked.h>

View File

@ -1,6 +1,5 @@
#include <stdio.h>
#include <malloc.h>
#include <winpr/crt.h>
#include <winpr/windows.h>
#include <winpr/interlocked.h>

View File

@ -31,7 +31,7 @@ set(TEST_AREA "${MODULE_NAME}Area")
foreach(test ${${MODULE_PREFIX}_TESTS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName} ${TEST_AREA})
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName} "${TESTING_OUTPUT_DIRECTORY}/${TEST_AREA}")
endforeach()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")

View File

@ -27,6 +27,6 @@ endif()
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}/${TEST_AREA}/${MODULE_NAME}")
set_target_properties(${MODULE_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}/${TEST_AREA}/${MODULE_NAME}")
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test/Extra")

View File

@ -27,7 +27,7 @@ endif()
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}/${TEST_AREA}/${MODULE_NAME}")
set_target_properties(${MODULE_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}/${TEST_AREA}/${MODULE_NAME}")
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test/Extra")

View File

@ -27,6 +27,8 @@
#include <winpr/ndr.h>
#ifndef _WIN32
#include "ndr_array.h"
#include "ndr_context.h"
#include "ndr_pointer.h"
@ -344,3 +346,5 @@ CLIENT_CALL_RETURN NdrClientCall2(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRIN
return client_call_return;
}
#endif

View File

@ -28,6 +28,8 @@
#include "ndr_array.h"
#ifndef _WIN32
void NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
{
/**
@ -139,3 +141,5 @@ void NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemo
printf("warning: NdrComplexArrayBufferSize unimplemented\n");
}
#endif

View File

@ -22,10 +22,14 @@
#include <winpr/rpc.h>
#ifndef _WIN32
void NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
void NdrConformantVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
void NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
void NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
void NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
#endif
#endif /* WINPR_RPC_NDR_ARRAY_H */

View File

@ -25,6 +25,9 @@
#include <stdlib.h>
#include <winpr/rpc.h>
#ifndef _WIN32
#include "ndr_context.h"
#include "ndr_private.h"
@ -68,3 +71,5 @@ void NdrContextHandleBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMem
NdrpIncrementLength(&(pStubMsg->BufferLength), 20);
}
}
#endif

View File

@ -22,6 +22,10 @@
#include <winpr/rpc.h>
#ifndef _WIN32
void NdrContextHandleBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
#endif
#endif /* WINPR_RPC_NDR_CONTEXT_H */

View File

@ -25,6 +25,9 @@
#include <stdlib.h>
#include <winpr/rpc.h>
#ifndef _WIN32
#include "ndr_correlation.h"
#include "ndr_private.h"
@ -189,3 +192,5 @@ PFORMAT_STRING NdrpComputeVariance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* p
return pFormat;
}
#endif

View File

@ -22,8 +22,12 @@
#include <winpr/rpc.h>
#ifndef _WIN32
PFORMAT_STRING NdrpComputeCount(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat, ULONG_PTR* pCount);
PFORMAT_STRING NdrpComputeConformance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
PFORMAT_STRING NdrpComputeVariance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
#endif
#endif /* WINPR_RPC_NDR_CORRELATION_H */

View File

@ -25,6 +25,9 @@
#include <stdlib.h>
#include <winpr/rpc.h>
#ifndef _WIN32
#include "ndr_pointer.h"
#include "ndr_private.h"
@ -324,3 +327,5 @@ void NdrByteCountPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* p
{
printf("warning: NdrByteCountPointerBufferSize unimplemented\n");
}
#endif

View File

@ -22,6 +22,8 @@
#include <winpr/rpc.h>
#ifndef _WIN32
PFORMAT_STRING NdrpSkipPointerLayout(PFORMAT_STRING pFormat);
void NdrpPointerBufferSize(unsigned char* pMemory, PFORMAT_STRING pFormat, PMIDL_STUB_MESSAGE pStubMsg);
@ -34,4 +36,6 @@ PFORMAT_STRING NdrpEmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsign
void NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
void NdrByteCountPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
#endif
#endif /* WINPR_RPC_NDR_POINTER_H */

View File

@ -26,6 +26,8 @@
#include <winpr/rpc.h>
#ifndef _WIN32
#include "ndr_array.h"
#include "ndr_context.h"
#include "ndr_pointer.h"
@ -554,3 +556,5 @@ const NDR_TYPE_FREE_ROUTINE pfnFreeRoutines[] =
NULL, /* FC_END */
NULL, /* FC_PAD */
};
#endif

View File

@ -22,6 +22,8 @@
#include <winpr/rpc.h>
#ifndef _WIN32
void NdrpAlignLength(unsigned long* length, unsigned int alignment);
void NdrpIncrementLength(unsigned long* length, unsigned int size);
@ -39,4 +41,6 @@ extern const char* FC_TYPE_STRINGS[];
#include "ndr_correlation.h"
#endif
#endif /* WINPR_RPC_NDR_PRIVATE_H */

View File

@ -25,6 +25,9 @@
#include <stdlib.h>
#include <winpr/rpc.h>
#ifndef _WIN32
#include "ndr_simple.h"
#include "ndr_private.h"
@ -195,3 +198,5 @@ void NdrSimpleTypeFree(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFOR
{
}
#endif

View File

@ -22,6 +22,8 @@
#include <winpr/rpc.h>
#ifndef _WIN32
void NdrSimpleTypeBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
void NdrSimpleTypeMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar);
void NdrSimpleTypeUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar);
@ -32,4 +34,6 @@ char NdrGetSimpleTypeBufferSize(unsigned char FormatChar);
char NdrGetSimpleTypeMemorySize(unsigned char FormatChar);
int NdrGetTypeFlags(unsigned char FormatChar);
#endif
#endif /* WINPR_RPC_NDR_SIMPLE_H */

View File

@ -26,6 +26,8 @@
#include <winpr/rpc.h>
#ifndef _WIN32
#include "ndr_string.h"
void NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
@ -37,3 +39,6 @@ void NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char
{
printf("warning: NdrNonConformantStringBufferSize unimplemented\n");
}
#endif

View File

@ -22,7 +22,11 @@
#include <winpr/rpc.h>
#ifndef _WIN32
void NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
void NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
#endif
#endif /* WINPR_RPC_NDR_STRING_H */

View File

@ -25,6 +25,9 @@
#include <stdlib.h>
#include <winpr/rpc.h>
#ifndef _WIN32
#include "ndr_private.h"
#include "ndr_pointer.h"
#include "ndr_structure.h"
@ -315,3 +318,5 @@ void NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMem
pStubMsg->PointerLength = 0;
}
}
#endif

View File

@ -22,9 +22,13 @@
#include <winpr/rpc.h>
#ifndef _WIN32
void NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
void NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
void NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
void NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
#endif
#endif /* WINPR_RPC_NDR_STRUCTURE_H */

View File

@ -26,6 +26,8 @@
#include <winpr/rpc.h>
#ifndef _WIN32
#include "ndr_union.h"
void NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
@ -37,3 +39,5 @@ void NdrNonEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned cha
{
printf("warning: NdrNonEncapsulatedUnionBufferSize unimplemented\n");
}
#endif

View File

@ -22,7 +22,11 @@
#include <winpr/rpc.h>
#ifndef _WIN32
void NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
void NdrNonEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
#endif
#endif /* WINPR_RPC_NDR_UNION_H */

Some files were not shown because too many files have changed in this diff Show More