mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
winpr: stubbed pipe module, added some test stubs
This commit is contained in:
@@ -150,8 +150,6 @@ WINPR_API LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination,
|
||||
|
||||
/* Doubly-Linked List */
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
VOID InitializeListHead(PLIST_ENTRY ListHead);
|
||||
|
||||
BOOL IsListEmpty(const LIST_ENTRY* ListHead);
|
||||
@@ -168,7 +166,5 @@ VOID AppendTailList(PLIST_ENTRY ListHead, PLIST_ENTRY ListToAppend);
|
||||
VOID PushEntryList(PSINGLE_LIST_ENTRY ListHead, PSINGLE_LIST_ENTRY Entry);
|
||||
PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY ListHead);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* WINPR_INTERLOCKED_H */
|
||||
|
||||
|
||||
33
winpr/include/winpr/pipe.h
Normal file
33
winpr/include/winpr/pipe.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* WinPR: Windows Portable Runtime
|
||||
* Pipe Functions
|
||||
*
|
||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef WINPR_PIPE_H
|
||||
#define WINPR_PIPE_H
|
||||
|
||||
#include <winpr/winpr.h>
|
||||
#include <winpr/error.h>
|
||||
#include <winpr/wtypes.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
WINPR_API BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* WINPR_PIPE_H */
|
||||
@@ -21,6 +21,10 @@ set(MODULE_PREFIX "WINPR_ASN1")
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
asn1.c)
|
||||
|
||||
if(MSVC AND (NOT WITH_MONOLITHIC_BUILD))
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
|
||||
endif()
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS})
|
||||
else()
|
||||
@@ -36,3 +40,7 @@ else()
|
||||
endif()
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR")
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
3
winpr/libwinpr/asn1/module.def
Normal file
3
winpr/libwinpr/asn1/module.def
Normal file
@@ -0,0 +1,3 @@
|
||||
LIBRARY "libwinpr-asn1"
|
||||
EXPORTS
|
||||
|
||||
2
winpr/libwinpr/asn1/test/.gitignore
vendored
Normal file
2
winpr/libwinpr/asn1/test/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
TestAsn1
|
||||
TestAsn1.c
|
||||
34
winpr/libwinpr/asn1/test/CMakeLists.txt
Normal file
34
winpr/libwinpr/asn1/test/CMakeLists.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
set(MODULE_NAME "TestAsn1")
|
||||
set(MODULE_PREFIX "TEST_ASN1")
|
||||
|
||||
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
|
||||
|
||||
set(${MODULE_PREFIX}_TESTS
|
||||
TestAsn1Module.c
|
||||
TestAsn1Encoder.c
|
||||
TestAsn1Decoder.c
|
||||
TestAsn1Encode.c
|
||||
TestAsn1Decode.c
|
||||
TestAsn1String.c
|
||||
TestAsn1Integer.c
|
||||
TestAsn1Compare.c
|
||||
TestAsn1BerEnc.c
|
||||
TestAsn1BerDec.c
|
||||
TestAsn1DerEnc.c
|
||||
TestAsn1DerDec.c)
|
||||
|
||||
create_test_sourcelist(${MODULE_PREFIX}_SRCS
|
||||
${${MODULE_PREFIX}_DRIVER}
|
||||
${${MODULE_PREFIX}_TESTS})
|
||||
|
||||
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
target_link_libraries(${MODULE_NAME} winpr-asn1)
|
||||
|
||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||
get_filename_component(TestName ${test} NAME_WE)
|
||||
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
||||
endforeach()
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1BerDec.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1BerDec.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1BerDec(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1BerEnc.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1BerEnc.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1BerEnc(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1Compare.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1Compare.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1Compare(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1Decode.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1Decode.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1Decode(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1Decoder.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1Decoder.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1Decoder(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1DerDec.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1DerDec.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1DerDec(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1DerEnc.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1DerEnc.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1DerEnc(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1Encode.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1Encode.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1Encode(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1Encoder.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1Encoder.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1Encoder(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1Integer.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1Integer.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1Integer(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1Module.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1Module.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1Module(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
winpr/libwinpr/asn1/test/TestAsn1String.c
Normal file
11
winpr/libwinpr/asn1/test/TestAsn1String.c
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/asn1.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestAsn1String(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@ set(${MODULE_PREFIX}_SRCS
|
||||
handle.c
|
||||
table.c)
|
||||
|
||||
if(MSVC AND (NOT WITH_MONOLITHIC_BUILD))
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
|
||||
endif()
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS})
|
||||
else()
|
||||
|
||||
3
winpr/libwinpr/handle/module.def
Normal file
3
winpr/libwinpr/handle/module.def
Normal file
@@ -0,0 +1,3 @@
|
||||
LIBRARY "libwinpr-handle"
|
||||
EXPORTS
|
||||
|
||||
@@ -294,8 +294,6 @@ LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG E
|
||||
* http://msdn.microsoft.com/en-us/library/windows/hardware/ff563802/
|
||||
*/
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
VOID InitializeListHead(PLIST_ENTRY ListHead)
|
||||
{
|
||||
ListHead->Flink = ListHead->Blink = ListHead;
|
||||
@@ -395,4 +393,3 @@ PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY ListHead)
|
||||
return FirstEntry;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
LIBRARY "libwinpr-interlocked"
|
||||
EXPORTS
|
||||
InterlockedCompareExchange64 @1
|
||||
InitializeListHead @2
|
||||
IsListEmpty @3
|
||||
RemoveEntryList @4
|
||||
InsertHeadList @5
|
||||
RemoveHeadList @6
|
||||
InsertTailList @7
|
||||
RemoveTailList @8
|
||||
AppendTailList @9
|
||||
PushEntryList @10
|
||||
PopEntryList @11
|
||||
|
||||
@@ -11,7 +11,7 @@ int TestLibraryGetProcAddress(int argc, char* argv[])
|
||||
char* str;
|
||||
int length;
|
||||
LPTSTR BasePath;
|
||||
HINSTANCE library;
|
||||
//HINSTANCE library;
|
||||
LPTSTR LibraryPath;
|
||||
|
||||
str = argv[1];
|
||||
|
||||
47
winpr/libwinpr/pipe/CMakeLists.txt
Normal file
47
winpr/libwinpr/pipe/CMakeLists.txt
Normal file
@@ -0,0 +1,47 @@
|
||||
# WinPR: Windows Portable Runtime
|
||||
# libwinpr-pipe cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(MODULE_NAME "winpr-pipe")
|
||||
set(MODULE_PREFIX "WINPR_PIPE")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
pipe.c)
|
||||
|
||||
if(MSVC AND (NOT WITH_MONOLITHIC_BUILD))
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
|
||||
endif()
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS})
|
||||
else()
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
endif()
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
|
||||
else()
|
||||
target_link_libraries(${MODULE_NAME} winpr-crt)
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR")
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
9
winpr/libwinpr/pipe/ModuleOptions.cmake
Normal file
9
winpr/libwinpr/pipe/ModuleOptions.cmake
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
set(MINWIN_LAYER "1")
|
||||
set(MINWIN_GROUP "core")
|
||||
set(MINWIN_MAJOR_VERSION "2")
|
||||
set(MINWIN_MINOR_VERSION "0")
|
||||
set(MINWIN_SHORT_NAME "namedpipe")
|
||||
set(MINWIN_LONG_NAME "Named Pipe Functions")
|
||||
set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")
|
||||
|
||||
3
winpr/libwinpr/pipe/module.def
Normal file
3
winpr/libwinpr/pipe/module.def
Normal file
@@ -0,0 +1,3 @@
|
||||
LIBRARY "libwinpr-pipe"
|
||||
EXPORTS
|
||||
|
||||
35
winpr/libwinpr/pipe/pipe.c
Normal file
35
winpr/libwinpr/pipe/pipe.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* WinPR: Windows Portable Runtime
|
||||
* Pipe Functions
|
||||
*
|
||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <winpr/pipe.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
3
winpr/libwinpr/pipe/test/.gitignore
vendored
Normal file
3
winpr/libwinpr/pipe/test/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
TestPipe
|
||||
TestPipe.c
|
||||
|
||||
23
winpr/libwinpr/pipe/test/CMakeLists.txt
Normal file
23
winpr/libwinpr/pipe/test/CMakeLists.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
set(MODULE_NAME "TestPipe")
|
||||
set(MODULE_PREFIX "TEST_PIPE")
|
||||
|
||||
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
|
||||
|
||||
set(${MODULE_PREFIX}_TESTS
|
||||
TestPipeCreatePipe.c)
|
||||
|
||||
create_test_sourcelist(${MODULE_PREFIX}_SRCS
|
||||
${${MODULE_PREFIX}_DRIVER}
|
||||
${${MODULE_PREFIX}_TESTS})
|
||||
|
||||
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
target_link_libraries(${MODULE_NAME} winpr-pipe)
|
||||
|
||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||
get_filename_component(TestName ${test} NAME_WE)
|
||||
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
||||
endforeach()
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")
|
||||
12
winpr/libwinpr/pipe/test/TestPipeCreatePipe.c
Normal file
12
winpr/libwinpr/pipe/test/TestPipeCreatePipe.c
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/pipe.h>
|
||||
#include <winpr/tchar.h>
|
||||
#include <winpr/winpr.h>
|
||||
|
||||
int TestPipeCreatePipe(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ int TestEnumerateSecurityPackages(int argc, char* argv[])
|
||||
|
||||
printf("\nEnumerateSecurityPackages (%d):\n", (unsigned int)cPackages);
|
||||
|
||||
for (index = 0; index < cPackages; index++)
|
||||
for (index = 0; index < (int) cPackages; index++)
|
||||
{
|
||||
printf("\"%s\", \"%s\"\n", pPackageInfo[index].Name, pPackageInfo[index].Comment);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@ set(${MODULE_PREFIX}_SRCS
|
||||
thread.c
|
||||
tls.c)
|
||||
|
||||
if(MSVC AND (NOT WITH_MONOLITHIC_BUILD))
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
|
||||
endif()
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS})
|
||||
else()
|
||||
|
||||
3
winpr/libwinpr/thread/module.def
Normal file
3
winpr/libwinpr/thread/module.def
Normal file
@@ -0,0 +1,3 @@
|
||||
LIBRARY "libwinpr-thread"
|
||||
EXPORTS
|
||||
|
||||
Reference in New Issue
Block a user