mirror of
https://github.com/reactos/reactos
synced 2025-10-06 08:22:58 +02:00
Compare commits
200 Commits
backups/al
...
ReactOS-0.
Author | SHA1 | Date | |
---|---|---|---|
|
cab21f1645 | ||
|
e71045efa1 | ||
|
da20aaac90 | ||
|
8561239392 | ||
|
a7319af3dd | ||
|
a19892ea08 | ||
|
f66ca04807 | ||
|
60593571fd | ||
|
5503685d2d | ||
|
9cad93ac31 | ||
|
3a64b132cf | ||
|
791f54a818 | ||
|
9f3de03641 | ||
|
0a3129deb1 | ||
|
45724d8de2 | ||
|
3223773dbc | ||
|
15445b6ebc | ||
|
0fa542f1e0 | ||
|
4bbcb97553 | ||
|
aca728a62f | ||
|
ded6fcca88 | ||
|
6d66d4da2c | ||
|
9019d252be | ||
|
847aa89893 | ||
|
1020ee4805 | ||
|
c72257a26f | ||
|
d1274928bb | ||
|
8753158ddb | ||
|
b6ef4c6ee6 | ||
|
96b374677d | ||
|
4dde3a1c21 | ||
|
37c4d8279f | ||
|
c79360a933 | ||
|
baefc0115b | ||
|
d86736989a | ||
|
11c6007bb9 | ||
|
31046fef6e | ||
|
4d47498931 | ||
|
ba0f1263e4 | ||
|
9577665661 | ||
|
c165636757 | ||
|
a00d9b33dc | ||
|
534636f9ce | ||
|
9189284a9d | ||
|
89cc6c3c47 | ||
|
080bf05b6d | ||
|
f07f87eb09 | ||
|
bb2b8992b4 | ||
|
53ac0de2ad | ||
|
03cf4fc8db | ||
|
6b116da4a1 | ||
|
206cbe2545 | ||
|
ff056457a2 | ||
|
e95a8de179 | ||
|
23265de0b9 | ||
|
4bf67aaf0f | ||
|
fbfe053b9b | ||
|
82c445e96b | ||
|
1fa5efe3d7 | ||
|
40b71ac19d | ||
|
3f249a0a67 | ||
|
d001f75197 | ||
|
d24e173122 | ||
|
43bfb5dd4e | ||
|
23475fc1f9 | ||
|
cea2f0f1d2 | ||
|
67b97bc9ef | ||
|
f4ccfedf3e | ||
|
aafd813531 | ||
|
33d7cd5d53 | ||
|
ef5b410045 | ||
|
cb05e516a2 | ||
|
e035ce116b | ||
|
2423a80b6b | ||
|
37ac253ad6 | ||
|
68ed284f6e | ||
|
9b56503fc8 | ||
|
2850638aad | ||
|
d4a5e08d97 | ||
|
402686e69a | ||
|
67347846ec | ||
|
0eb4051a93 | ||
|
f20f399309 | ||
|
e7005a9352 | ||
|
f9279fd739 | ||
|
9bc71c43a2 | ||
|
9a10a39940 | ||
|
8c43665c8d | ||
|
5df62c8577 | ||
|
9cc503a1b2 | ||
|
f689818f82 | ||
|
cb8820f660 | ||
|
86f13a4752 | ||
|
78237daf70 | ||
|
df94eae35b | ||
|
42819f010e | ||
|
9309c80c1b | ||
|
3f89e7fa88 | ||
|
5672781aa4 | ||
|
2f460387c0 | ||
|
666973de7f | ||
|
437f357dd1 | ||
|
009fddf0b2 | ||
|
61c807a7ec | ||
|
11039e6faf | ||
|
61dcda8178 | ||
|
e51a2aab8f | ||
|
97445cc205 | ||
|
4b9a323664 | ||
|
8b97b835f2 | ||
|
3d801bebec | ||
|
6a7ba78c91 | ||
|
e33a78f93b | ||
|
cfdb595cc6 | ||
|
865a496525 | ||
|
78dbb934c2 | ||
|
05df4eff43 | ||
|
fa4bd57bed | ||
|
f1fa92f6fc | ||
|
c367070483 | ||
|
6f699ce531 | ||
|
a8ea6a6ab4 | ||
|
a3e183bd64 | ||
|
7019953f42 | ||
|
fd01d2046a | ||
|
57946d8a9a | ||
|
785ffdc0da | ||
|
e19f4b7bd9 | ||
|
7ac15d3bbf | ||
|
1bb6977546 | ||
|
b1ce653a14 | ||
|
b607cb6445 | ||
|
3d00595df2 | ||
|
539c296fa7 | ||
|
5751b32540 | ||
|
e9ae9105f5 | ||
|
2d250ad2a7 | ||
|
12da975bfd | ||
|
779a7eeb41 | ||
|
aed77689d2 | ||
|
85fdc76fb2 | ||
|
c9f8b0e7e0 | ||
|
0418e694e6 | ||
|
28eb04c4db | ||
|
29bd3ad1f9 | ||
|
d288e05d38 | ||
|
a3c3364289 | ||
|
27f383b70d | ||
|
84a36613f5 | ||
|
53170a9c19 | ||
|
d6c9cf0a41 | ||
|
e6bf69e0ae | ||
|
0d216dc91a | ||
|
0618186aa6 | ||
|
154d6c64f8 | ||
|
fbff6fe0f0 | ||
|
b2f5efa2cf | ||
|
29f3606a01 | ||
|
bf89d5df7d | ||
|
0bf2971d1a | ||
|
bc1cb8bf6e | ||
|
108b495229 | ||
|
2a13486746 | ||
|
322dbd6fba | ||
|
6830474b06 | ||
|
7bc94f8976 | ||
|
566c2840b9 | ||
|
523d77cc92 | ||
|
0c969fe931 | ||
|
0aa810f5e1 | ||
|
7fd17a9a85 | ||
|
b21f552e3b | ||
|
fd962e2f04 | ||
|
b2a42182ef | ||
|
a8f6850b9f | ||
|
64c70941d3 | ||
|
052a86b641 | ||
|
62fe406292 | ||
|
f954a88f34 | ||
|
5307ffb9c6 | ||
|
510dc740a5 | ||
|
8871c0355a | ||
|
466b206539 | ||
|
17f773cb7d | ||
|
653d79d129 | ||
|
57787bb881 | ||
|
724d399a3f | ||
|
e58c615243 | ||
|
3db0384e86 | ||
|
0e37d806a5 | ||
|
3ed09e40d9 | ||
|
e8451b25d5 | ||
|
eab893a17c | ||
|
7c7a235e5f | ||
|
5bbfa0aa1d | ||
|
fe2a7b4489 | ||
|
94066e01ef | ||
|
b89e71762d | ||
|
b6926c02fc | ||
|
6cc6c8571b |
40
os2/lib/doscalls/memory/memory.cpp
Normal file
40
os2/lib/doscalls/memory/memory.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
|
||||
|
||||
// TODO: HEader: To be pasted
|
||||
|
||||
|
||||
|
||||
|
||||
// INCL_DOSMEMMGR || !INCL_NOCOMMON
|
||||
#define INCL_DOSMEMMGR
|
||||
#undefine INCL_NOCOMMON
|
||||
|
||||
#include <os2.h>
|
||||
|
||||
|
||||
// TODO: Expain that this is for memory alloc/free funcs of Os2 api
|
||||
|
||||
|
||||
|
||||
// TODO: Implement functions and give them bodies
|
||||
ULONG DosAllocMem (PPVOID pBaseAddress, ULONG ulObjectSize,
|
||||
ULONG ulAllocationFlags);
|
||||
ULONG DosAllocSharedMem (PPVOID pBaseAddress, PCSZ pszName,
|
||||
ULONG ulObjectSize, ULONG ulAllocationFlags);
|
||||
ULONG DosFreeMem (PVOID pBaseAddress);
|
||||
ULONG DosGetNamedSharedMem (PPVOID pBaseAddress, PCSZ pszSharedMemName,
|
||||
ULONG ulAttributeFlags);
|
||||
ULONG DosGetSharedMem (CPVOID pBaseAddress, ULONG ulAttributeFlags);
|
||||
ULONG DosGiveSharedMem (CPVOID pBaseAddress, PID idProcessId,
|
||||
ULONG ulAttributeFlags);
|
||||
ULONG DosQueryMem (CPVOID pBaseAddress, PULONG pulRegionSize,
|
||||
PULONG pulAllocationFlags);
|
||||
ULONG DosSetMem (CPVOID pBaseAddress, ULONG ulRegionSize,
|
||||
ULONG ulAttributeFlags);
|
||||
ULONG DosSubAllocMem (PVOID pOffset, PPVOID pBlockOffset, ULONG ulSize);
|
||||
ULONG DosSubFreeMem (PVOID pOffset, PVOID pBlockOffset, ULONG ulSize);
|
||||
ULONG DosSubSetMem (PVOID pOffset, ULONG ulFlags, ULONG ulSize);
|
||||
ULONG DosSubUnsetMem (PVOID pOffset);
|
||||
|
||||
// TODO: Add file to makefile
|
@@ -61,8 +61,8 @@ DLLS_SHELLEXT = shellext
|
||||
DLLS = acledit aclui advapi32 advpack cabinet cards comctl32 crtdll comdlg32 d3d8thk dbghelp expat fmifs freetype \
|
||||
gdi32 gdiplus glu32 hid imagehlp imm32 iphlpapi kernel32 lzexpand mesa32 midimap mmdrv mpr msacm msafd \
|
||||
msgina msi msimg32 msvcrt20 msvideo mswsock netapi32 ntdll ole32 oleaut32 oledlg olepro32 opengl32 \
|
||||
packet psapi riched20 richedit rpcrt4 samlib secur32 setupapi shell32 shlwapi smdll snmpapi syssetup \
|
||||
twain user32 userenv version wininet winmm winspool ws2help ws2_32 wsock32 wshirda dnsapi \
|
||||
packet psapi riched20 richedit rpcrt4 samlib secur32 setupapi shell32 shlwapi smlib smdll snmpapi \
|
||||
syssetup twain user32 userenv version wininet winmm winspool ws2help ws2_32 wsock32 wshirda dnsapi \
|
||||
urlmon shdocvw dinput dinput8 dxdiagn devenum dsound lsasrv $(DLLS_KBD) $(DLLS_CPL) $(DLLS_SHELLEXT)
|
||||
|
||||
SUBSYS = smss win32k csrss ntvdm
|
||||
|
@@ -9,7 +9,7 @@ include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
# Console system utilities
|
||||
# cabman cat net objdir partinfo pice ps sc stats
|
||||
UTIL_APPS = cat objdir partinfo pnpdump sc shutdown stats tickcount consw ps
|
||||
UTIL_APPS = cat objdir partinfo pnpdump sc shutdown stats tickcount ps
|
||||
|
||||
UTIL_NET_APPS = arp finger ftp ipconfig netstat ping route telnet whois
|
||||
|
||||
|
@@ -1,23 +1,21 @@
|
||||
# $Id$
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = consw
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = binpatch
|
||||
|
||||
TARGET_SDKLIBS =
|
||||
|
||||
TARGET_OBJECTS = patch.o
|
||||
|
||||
TARGET_CFLAGS += -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
615
reactos/apps/utils/binpatch/patch.c
Normal file
615
reactos/apps/utils/binpatch/patch.c
Normal file
@@ -0,0 +1,615 @@
|
||||
#include <conio.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/** DEFINES *******************************************************************/
|
||||
|
||||
#define PATCH_BUFFER_SIZE 4096 /* Maximum size of a patch */
|
||||
#define PATCH_BUFFER_MAGIC "\xde\xad\xbe\xef MaGiC MaRk "
|
||||
#define SIZEOF_PATCH_BUFFER_MAGIC (sizeof (PATCH_BUFFER_MAGIC) - 1)
|
||||
|
||||
/** TYPES *********************************************************************/
|
||||
|
||||
typedef struct _PatchedByte
|
||||
{
|
||||
int offset; /*!< File offset of the patched byte. */
|
||||
unsigned char expected; /*!< Expected (original) value of the byte. */
|
||||
unsigned char patched; /*!< Patched (new) value for the byte. */
|
||||
} PatchedByte;
|
||||
|
||||
typedef struct _PatchedFile
|
||||
{
|
||||
const char *name; /*!< Name of the file to be patched. */
|
||||
int fileSize; /*!< Size of the file in bytes. */
|
||||
int patchCount; /*!< Number of patches for the file. */
|
||||
PatchedByte *patches; /*!< Patches for the file. */
|
||||
} PatchedFile;
|
||||
|
||||
typedef struct _Patch
|
||||
{
|
||||
const char *name; /*!< Name of the patch. */
|
||||
int fileCount; /*!< Number of files in the patch. */
|
||||
PatchedFile *files; /*!< Files for the patch. */
|
||||
} Patch;
|
||||
|
||||
/** FUNCTION PROTOTYPES *******************************************************/
|
||||
|
||||
static void printUsage();
|
||||
|
||||
/** GLOBALS *******************************************************************/
|
||||
|
||||
static Patch m_patch = { NULL, 0, NULL };
|
||||
static int m_argc = 0;
|
||||
static char **m_argv = NULL;
|
||||
|
||||
/* patch buffer where we put the patch info into */
|
||||
static unsigned char m_patchBuffer[SIZEOF_PATCH_BUFFER_MAGIC + PATCH_BUFFER_SIZE] =
|
||||
PATCH_BUFFER_MAGIC;
|
||||
|
||||
/** HELPER FUNCTIONS **********************************************************/
|
||||
|
||||
static void *
|
||||
loadFile(const char *fileName, int *fileSize_)
|
||||
{
|
||||
FILE *f;
|
||||
struct stat sb;
|
||||
int fileSize;
|
||||
void *p;
|
||||
|
||||
/* Open the file */
|
||||
f = fopen(fileName, "rb");
|
||||
if (f == NULL)
|
||||
{
|
||||
printf("Couldn't open file %s for reading!\n", fileName);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get file size */
|
||||
if (fstat(fileno(f), &sb) < 0)
|
||||
{
|
||||
fclose(f);
|
||||
printf("Couldn't get size of file %s!\n", fileName);
|
||||
return NULL;
|
||||
}
|
||||
fileSize = sb.st_size;
|
||||
|
||||
/* Load file */
|
||||
p = malloc(fileSize);
|
||||
if (p == NULL)
|
||||
{
|
||||
fclose(f);
|
||||
printf("Couldn't allocate %d bytes for file %s!\n", fileSize, fileName);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fread(p, fileSize, 1, f) != 1)
|
||||
{
|
||||
fclose(f);
|
||||
free(p);
|
||||
printf("Couldn't read file %s into memory!\n", fileName);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Close file */
|
||||
fclose(f);
|
||||
|
||||
*fileSize_ = fileSize;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
saveFile(const char *fileName, void *file, int fileSize)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
/* Open the file */
|
||||
f = fopen(fileName, "wb");
|
||||
if (f == NULL)
|
||||
{
|
||||
printf("Couldn't open file %s for writing!\n", fileName);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Write file */
|
||||
if (fwrite(file, fileSize, 1, f) != 1)
|
||||
{
|
||||
fclose(f);
|
||||
printf("Couldn't write file %s!\n", fileName);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Close file */
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
compareFiles(
|
||||
PatchedFile *patchedFile,
|
||||
const char *originalFileName)
|
||||
{
|
||||
const char *patchedFileName = patchedFile->name;
|
||||
unsigned char *origChunk, *patchedChunk;
|
||||
int origSize, patchedSize, i, patchCount;
|
||||
PatchedByte *patches = NULL;
|
||||
int patchesArrayCount = 0;
|
||||
|
||||
/* Load both files */
|
||||
origChunk = loadFile(originalFileName, &origSize);
|
||||
if (origChunk == NULL)
|
||||
return -1;
|
||||
patchedChunk = loadFile(patchedFileName, &patchedSize);
|
||||
if (patchedChunk == NULL)
|
||||
{
|
||||
free(origChunk);
|
||||
return -1;
|
||||
}
|
||||
if (origSize != patchedSize)
|
||||
{
|
||||
free(origChunk);
|
||||
free(patchedChunk);
|
||||
printf("File size of %s and %s differs (%d != %d)\n",
|
||||
originalFileName, patchedFileName,
|
||||
origSize, patchedSize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Compare the files and record any differences */
|
||||
printf("Comparing %s to %s", originalFileName, patchedFileName);
|
||||
for (i = 0, patchCount = 0; i < origSize; i++)
|
||||
{
|
||||
if (origChunk[i] != patchedChunk[i])
|
||||
{
|
||||
patchCount++;
|
||||
|
||||
/* Resize patches array if needed */
|
||||
if (patchesArrayCount < patchCount)
|
||||
{
|
||||
PatchedByte *newPatches;
|
||||
newPatches = realloc(patches, patchCount * sizeof (PatchedByte));
|
||||
if (newPatches == NULL)
|
||||
{
|
||||
if (patches != NULL)
|
||||
free(patches);
|
||||
free(origChunk);
|
||||
free(patchedChunk);
|
||||
printf("\nOut of memory (tried to allocated %d bytes)\n",
|
||||
patchCount * sizeof (PatchedByte));
|
||||
return -1;
|
||||
}
|
||||
patches = newPatches;
|
||||
}
|
||||
|
||||
/* Fill in patch info */
|
||||
patches[patchCount - 1].offset = i;
|
||||
patches[patchCount - 1].expected = origChunk[i];
|
||||
patches[patchCount - 1].patched = patchedChunk[i];
|
||||
}
|
||||
if ((i % (origSize / 40)) == 0)
|
||||
printf(".");
|
||||
}
|
||||
printf(" %d changed bytes found.\n", patchCount);
|
||||
|
||||
/* Unload the files */
|
||||
free(origChunk);
|
||||
free(patchedChunk);
|
||||
|
||||
/* Save patch info */
|
||||
patchedFile->fileSize = patchedSize;
|
||||
patchedFile->patchCount = patchCount;
|
||||
patchedFile->patches = patches;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
outputPatch(const char *outputFileName)
|
||||
{
|
||||
unsigned char *patchExe, *patchBuffer;
|
||||
int i, size, patchExeSize, patchSize, stringSize, stringOffset, patchOffset;
|
||||
Patch *patch;
|
||||
PatchedFile *files;
|
||||
|
||||
printf("Putting patch into %s...\n", outputFileName);
|
||||
|
||||
/* Calculate size of the patch */
|
||||
patchSize = sizeof (Patch) + sizeof (PatchedFile) * m_patch.fileCount;
|
||||
stringSize = strlen(m_patch.name) + 1;
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
stringSize += strlen(m_patch.files[i].name) + 1;
|
||||
patchSize += sizeof (PatchedByte) * m_patch.files[i].patchCount;
|
||||
}
|
||||
if ((stringSize + patchSize) > PATCH_BUFFER_SIZE)
|
||||
{
|
||||
printf("Patch is too big - %d bytes maximum, %d bytes needed\n",
|
||||
PATCH_BUFFER_SIZE, stringSize + patchSize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Load patch.exe file into memory... */
|
||||
patchExe = loadFile(m_argv[0], &patchExeSize);
|
||||
if (patchExe == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Try to find the magic mark for the patch buffer */
|
||||
for (i = 0; i < (patchExeSize - SIZEOF_PATCH_BUFFER_MAGIC); i++)
|
||||
{
|
||||
if (memcmp(patchExe + i, m_patchBuffer, SIZEOF_PATCH_BUFFER_MAGIC) == 0)
|
||||
{
|
||||
patchBuffer = patchExe + i + SIZEOF_PATCH_BUFFER_MAGIC;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!(i < (patchExeSize - SIZEOF_PATCH_BUFFER_MAGIC)))
|
||||
{
|
||||
free(patchExe);
|
||||
printf("Couldn't find patch buffer magic in file %s - this shouldn't happen!!!\n", m_argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Pack patch together and replace string pointers by offsets */
|
||||
patch = (Patch *)patchBuffer;
|
||||
files = (PatchedFile *)(patchBuffer + sizeof (Patch));
|
||||
patchOffset = sizeof (Patch) + sizeof (PatchedFile) * m_patch.fileCount;
|
||||
stringOffset = patchSize;
|
||||
|
||||
patch->fileCount = m_patch.fileCount;
|
||||
patch->files = (PatchedFile *)sizeof (Patch);
|
||||
|
||||
patch->name = (const char *)stringOffset;
|
||||
strcpy(patchBuffer + stringOffset, m_patch.name);
|
||||
stringOffset += strlen(m_patch.name) + 1;
|
||||
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
files[i].fileSize = m_patch.files[i].fileSize;
|
||||
files[i].patchCount = m_patch.files[i].patchCount;
|
||||
|
||||
files[i].name = (const char *)stringOffset;
|
||||
strcpy(patchBuffer + stringOffset, m_patch.files[i].name);
|
||||
stringOffset += strlen(m_patch.files[i].name) + 1;
|
||||
|
||||
size = files[i].patchCount * sizeof (PatchedByte);
|
||||
files[i].patches = (PatchedByte *)patchOffset;
|
||||
memcpy(patchBuffer + patchOffset, m_patch.files[i].patches, size);
|
||||
patchOffset += size;
|
||||
}
|
||||
size = patchSize + stringSize;
|
||||
memset(patchBuffer + size, 0, PATCH_BUFFER_SIZE - size);
|
||||
|
||||
/* Save file */
|
||||
if (saveFile(outputFileName, patchExe, patchExeSize) < 0)
|
||||
{
|
||||
free(patchExe);
|
||||
return -1;
|
||||
}
|
||||
free(patchExe);
|
||||
|
||||
printf("Patch saved!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
loadPatch()
|
||||
{
|
||||
char *p;
|
||||
Patch *patch;
|
||||
int i;
|
||||
|
||||
p = m_patchBuffer + SIZEOF_PATCH_BUFFER_MAGIC;
|
||||
patch = (Patch *)p;
|
||||
|
||||
if (patch->name == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
m_patch.name = p + (int)patch->name;
|
||||
m_patch.fileCount = patch->fileCount;
|
||||
m_patch.files = (PatchedFile *)(p + (int)patch->files);
|
||||
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
m_patch.files[i].name = p + (int)m_patch.files[i].name;
|
||||
m_patch.files[i].patches = (PatchedByte *)(p + (int)m_patch.files[i].patches);
|
||||
}
|
||||
|
||||
printf("Patch %s loaded...\n", m_patch.name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/** MAIN FUNCTIONS ************************************************************/
|
||||
|
||||
static int
|
||||
createPatch()
|
||||
{
|
||||
int i, status;
|
||||
const char *outputFileName;
|
||||
|
||||
/* Check argument count */
|
||||
if (m_argc < 6 || (m_argc % 2) != 0)
|
||||
{
|
||||
printUsage();
|
||||
return -1;
|
||||
}
|
||||
|
||||
outputFileName = m_argv[3];
|
||||
m_patch.name = m_argv[2];
|
||||
|
||||
/* Allocate PatchedFiles array */
|
||||
m_patch.fileCount = (m_argc - 4) / 2;
|
||||
m_patch.files = malloc(m_patch.fileCount * sizeof (PatchedFile));
|
||||
if (m_patch.files == NULL)
|
||||
{
|
||||
printf("Out of memory!\n");
|
||||
return -1;
|
||||
}
|
||||
memset(m_patch.files, 0, m_patch.fileCount * sizeof (PatchedFile));
|
||||
|
||||
/* Compare original to patched files and fill m_patch.files array */
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
m_patch.files[i].name = m_argv[4 + (i * 2) + 1];
|
||||
status = compareFiles(m_patch.files + i, m_argv[4 + (i * 2) + 0]);
|
||||
if (status < 0)
|
||||
{
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
if (m_patch.files[i].patches != NULL)
|
||||
free(m_patch.files[i].patches);
|
||||
}
|
||||
free(m_patch.files);
|
||||
m_patch.files = NULL;
|
||||
m_patch.fileCount = 0;
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Output patch */
|
||||
return outputPatch(outputFileName);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
applyPatch()
|
||||
{
|
||||
int c, i, j, fileSize, makeBackup;
|
||||
unsigned char *file;
|
||||
char *p;
|
||||
const char *fileName;
|
||||
char buffer[MAX_PATH];
|
||||
|
||||
|
||||
if (m_argc > 1 && strcmp(m_argv[1], "-d") != 0)
|
||||
{
|
||||
printUsage();
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Load patch */
|
||||
if (loadPatch() < 0)
|
||||
{
|
||||
printf("This executable doesn't contain a patch, use -c to create one.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (m_argc > 1)
|
||||
{
|
||||
/* Dump patch */
|
||||
printf("Patch name: %s\n", m_patch.name);
|
||||
printf("File count: %d\n", m_patch.fileCount);
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
printf("----------------------\n"
|
||||
"File name: %s\n"
|
||||
"File size: %d bytes\n",
|
||||
m_patch.files[i].name, m_patch.files[i].fileSize);
|
||||
printf("Patch count: %d\n", m_patch.files[i].patchCount);
|
||||
for (j = 0; j < m_patch.files[i].patchCount; j++)
|
||||
{
|
||||
printf(" Offset 0x%x 0x%02x -> 0x%02x\n",
|
||||
m_patch.files[i].patches[j].offset,
|
||||
m_patch.files[i].patches[j].expected,
|
||||
m_patch.files[i].patches[j].patched);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Apply patch */
|
||||
printf("Applying patch...\n");
|
||||
for (i = 0; i < m_patch.fileCount; i++)
|
||||
{
|
||||
/* Load original file */
|
||||
fileName = m_patch.files[i].name;
|
||||
applyPatch_retry_file:
|
||||
file = loadFile(fileName, &fileSize);
|
||||
if (file == NULL)
|
||||
{
|
||||
printf("File %s not found! ", fileName);
|
||||
applyPatch_file_open_error:
|
||||
printf("(S)kip, (R)etry, (A)bort, (M)anually enter filename");
|
||||
do
|
||||
{
|
||||
c = getch();
|
||||
}
|
||||
while (c != 's' && c != 'r' && c != 'a' && c != 'm');
|
||||
printf("\n");
|
||||
if (c == 's')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (c == 'r')
|
||||
{
|
||||
goto applyPatch_retry_file;
|
||||
}
|
||||
else if (c == 'a')
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (c == 'm')
|
||||
{
|
||||
if (fgets(buffer, sizeof (buffer), stdin) == NULL)
|
||||
{
|
||||
printf("fgets() failed!\n");
|
||||
return -1;
|
||||
}
|
||||
p = strchr(buffer, '\r');
|
||||
if (p != NULL)
|
||||
*p = '\0';
|
||||
p = strchr(buffer, '\n');
|
||||
if (p != NULL)
|
||||
*p = '\0';
|
||||
|
||||
fileName = buffer;
|
||||
goto applyPatch_retry_file;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check file size */
|
||||
if (fileSize != m_patch.files[i].fileSize)
|
||||
{
|
||||
free(file);
|
||||
printf("File %s has unexpected filesize of %d bytes (%d bytes expected)\n",
|
||||
fileName, fileSize, m_patch.files[i].fileSize);
|
||||
if (fileName != m_patch.files[i].name) /* manually entered filename */
|
||||
{
|
||||
goto applyPatch_file_open_error;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Ask for backup */
|
||||
printf("Do you want to make a backup of %s? (Y)es, (N)o, (A)bort", fileName);
|
||||
do
|
||||
{
|
||||
c = getch();
|
||||
}
|
||||
while (c != 'y' && c != 'n' && c != 'a');
|
||||
printf("\n");
|
||||
if (c == 'y')
|
||||
{
|
||||
char buffer[MAX_PATH];
|
||||
snprintf(buffer, MAX_PATH, "%s.bak", fileName);
|
||||
buffer[MAX_PATH-1] = '\0';
|
||||
makeBackup = 1;
|
||||
if (access(buffer, 0) >= 0) /* file exists */
|
||||
{
|
||||
printf("File %s already exists, overwrite? (Y)es, (N)o, (A)bort", buffer);
|
||||
do
|
||||
{
|
||||
c = getch();
|
||||
}
|
||||
while (c != 'y' && c != 'n' && c != 'a');
|
||||
printf("\n");
|
||||
if (c == 'n')
|
||||
makeBackup = 0;
|
||||
else if (c == 'a')
|
||||
{
|
||||
free(file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (makeBackup && saveFile(buffer, file, fileSize) < 0)
|
||||
{
|
||||
free(file);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (c == 'a')
|
||||
{
|
||||
free(file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Patch file */
|
||||
for (j = 0; j < m_patch.files[i].patchCount; j++)
|
||||
{
|
||||
int offset = m_patch.files[i].patches[j].offset;
|
||||
if (file[offset] != m_patch.files[i].patches[j].expected)
|
||||
{
|
||||
printf("Unexpected value in file %s at offset 0x%x: expected = 0x%02x, found = 0x%02x\n",
|
||||
fileName, offset, m_patch.files[i].patches[j].expected, file[offset]);
|
||||
free(file);
|
||||
return -1;
|
||||
}
|
||||
file[offset] = m_patch.files[i].patches[j].patched;
|
||||
}
|
||||
|
||||
/* Save file */
|
||||
if (saveFile(fileName, file, fileSize) < 0)
|
||||
{
|
||||
free(file);
|
||||
return -1;
|
||||
}
|
||||
free(file);
|
||||
}
|
||||
|
||||
printf("Patch applied sucessfully!\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
printUsage()
|
||||
{
|
||||
printf("Usage:\n"
|
||||
"%s -c - Create patch\n"
|
||||
"%s -d - Dump patch\n"
|
||||
"%s - Apply patch\n"
|
||||
"\n"
|
||||
"A patch can be created like this:\n"
|
||||
"%s -c \"patch name\" output.exe file1.orig file1.patched[ file2.orig file2.patched[ ...]]\n",
|
||||
m_argv[0], m_argv[0], m_argv[0], m_argv[0]);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
m_argc = argc;
|
||||
m_argv = argv;
|
||||
|
||||
if (argc >= 2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0))
|
||||
{
|
||||
printUsage();
|
||||
return 0;
|
||||
}
|
||||
else if (argc >= 2 && argv[1][0] == '-')
|
||||
{
|
||||
if (strcmp(argv[1], "-c") == 0)
|
||||
{
|
||||
return createPatch();
|
||||
}
|
||||
else if (strcmp(argv[1], "-d") == 0)
|
||||
{
|
||||
return applyPatch();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Unknown option: %s\n"
|
||||
"Use -h for help.\n",
|
||||
argv[1]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return applyPatch();
|
||||
}
|
||||
|
@@ -1,30 +0,0 @@
|
||||
/* $Id$
|
||||
*
|
||||
* DESCRIPTION: Console mode switcher
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* REVISIONS
|
||||
* 2003-07-26 (arty)
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void STDCALL SetConsoleHardwareState( HANDLE conhandle,
|
||||
DWORD flags,
|
||||
DWORD state );
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if( argc > 1 ) {
|
||||
SetConsoleHardwareState( GetStdHandle( STD_INPUT_HANDLE ),
|
||||
0,
|
||||
!strcmp( argv[1], "hw" ) );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
@@ -1,5 +0,0 @@
|
||||
@echo off
|
||||
rem Turn off cosole, run a program, turn console on
|
||||
\reactos\bin\consw sw
|
||||
"%1" "%2" "%3" "%4" "%5" "%6" "%7" "%8" "%9"
|
||||
\reactos\bin\consw hw
|
949
reactos/apps/utils/winetest/config.h
Normal file
949
reactos/apps/utils/winetest/config.h
Normal file
@@ -0,0 +1,949 @@
|
||||
/* include/config.h. Generated by configure. */
|
||||
/* include/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
#define __WINE_CONFIG_H
|
||||
|
||||
/* Specifies the compiler flag that forces a short wchar_t */
|
||||
#define CC_FLAG_SHORT_WCHAR "-fshort-wchar"
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
/* #undef CRAY_STACKSEG_END */
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
/* #undef C_ALLOCA */
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
/* #undef HAVE_ALLOCA_H */
|
||||
|
||||
/* Define if you have ALSA 1.x including devel headers */
|
||||
/* #undef HAVE_ALSA */
|
||||
|
||||
/* Define to 1 if you have the <alsa/asoundlib.h> header file. */
|
||||
/* #undef HAVE_ALSA_ASOUNDLIB_H */
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
/* #undef HAVE_ARPA_INET_H */
|
||||
|
||||
/* Define to 1 if you have the <arpa/nameser.h> header file. */
|
||||
/* #undef HAVE_ARPA_NAMESER_H */
|
||||
|
||||
/* Define if you have ARTS sound server */
|
||||
/* #undef HAVE_ARTS */
|
||||
|
||||
/* Define if the assembler keyword .size is accepted */
|
||||
/* #undef HAVE_ASM_DOT_SIZE */
|
||||
|
||||
/* Define to 1 if you have the <audio/audiolib.h> header file. */
|
||||
/* #undef HAVE_AUDIO_AUDIOLIB_H */
|
||||
|
||||
/* Define to 1 if you have the <audio/soundlib.h> header file. */
|
||||
/* #undef HAVE_AUDIO_SOUNDLIB_H */
|
||||
|
||||
/* Define to 1 if you have the <capi20.h> header file. */
|
||||
/* #undef HAVE_CAPI20_H */
|
||||
|
||||
/* Define if you have capi4linux libs and headers */
|
||||
/* #undef HAVE_CAPI4LINUX */
|
||||
|
||||
/* Define to 1 if you have the `chsize' function. */
|
||||
#define HAVE_CHSIZE 1
|
||||
|
||||
/* Define to 1 if you have the `clone' function. */
|
||||
/* #undef HAVE_CLONE */
|
||||
|
||||
/* Define to 1 if you have the `connect' function. */
|
||||
/* #undef HAVE_CONNECT */
|
||||
|
||||
/* Define if we have linux/input.h AND it contains the INPUT event API */
|
||||
/* #undef HAVE_CORRECT_LINUXINPUT_H */
|
||||
|
||||
/* Define to 1 if you have the <cups/cups.h> header file. */
|
||||
/* #undef HAVE_CUPS_CUPS_H */
|
||||
|
||||
/* Define to 1 if you have the <curses.h> header file. */
|
||||
/* #undef HAVE_CURSES_H */
|
||||
|
||||
/* Define to 1 if you have the <direct.h> header file. */
|
||||
#define HAVE_DIRECT_H 1
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
/* #undef HAVE_DLFCN_H */
|
||||
|
||||
/* Define if you have dlopen */
|
||||
/* #undef HAVE_DLOPEN */
|
||||
|
||||
/* Define to 1 if you have the <elf.h> header file. */
|
||||
/* #undef HAVE_ELF_H */
|
||||
|
||||
/* Define to 1 if you have the `epoll_create' function. */
|
||||
/* #undef HAVE_EPOLL_CREATE */
|
||||
|
||||
/* Define to 1 if you have the `ffs' function. */
|
||||
/* #undef HAVE_FFS */
|
||||
|
||||
/* Define to 1 if you have the `finite' function. */
|
||||
#define HAVE_FINITE 1
|
||||
|
||||
/* Define to 1 if you have the <float.h> header file. */
|
||||
#define HAVE_FLOAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <fontconfig/fontconfig.h> header file. */
|
||||
/* #undef HAVE_FONTCONFIG_FONTCONFIG_H */
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
/* #undef HAVE_FORK */
|
||||
|
||||
/* Define to 1 if you have the `fpclass' function. */
|
||||
#define HAVE_FPCLASS 1
|
||||
|
||||
/* Define if FreeType 2 is installed */
|
||||
/* #undef HAVE_FREETYPE */
|
||||
|
||||
/* Define to 1 if you have the <freetype/freetype.h> header file. */
|
||||
/* #undef HAVE_FREETYPE_FREETYPE_H */
|
||||
|
||||
/* Define to 1 if you have the <freetype/ftglyph.h> header file. */
|
||||
/* #undef HAVE_FREETYPE_FTGLYPH_H */
|
||||
|
||||
/* Define to 1 if you have the <freetype/ftnames.h> header file. */
|
||||
/* #undef HAVE_FREETYPE_FTNAMES_H */
|
||||
|
||||
/* Define to 1 if you have the <freetype/ftoutln.h> header file. */
|
||||
/* #undef HAVE_FREETYPE_FTOUTLN_H */
|
||||
|
||||
/* Define to 1 if you have the <freetype/ftsnames.h> header file. */
|
||||
/* #undef HAVE_FREETYPE_FTSNAMES_H */
|
||||
|
||||
/* Define if you have the <freetype/fttrigon.h> header file. */
|
||||
/* #undef HAVE_FREETYPE_FTTRIGON_H */
|
||||
|
||||
/* Define to 1 if you have the <freetype/ftwinfnt.h> header file. */
|
||||
/* #undef HAVE_FREETYPE_FTWINFNT_H */
|
||||
|
||||
/* Define to 1 if you have the <freetype/internal/sfnt.h> header file. */
|
||||
/* #undef HAVE_FREETYPE_INTERNAL_SFNT_H */
|
||||
|
||||
/* Define to 1 if you have the <freetype/ttnameid.h> header file. */
|
||||
/* #undef HAVE_FREETYPE_TTNAMEID_H */
|
||||
|
||||
/* Define to 1 if you have the <freetype/tttables.h> header file. */
|
||||
/* #undef HAVE_FREETYPE_TTTABLES_H */
|
||||
|
||||
/* Define to 1 if the system has the type `fsblkcnt_t'. */
|
||||
/* #undef HAVE_FSBLKCNT_T */
|
||||
|
||||
/* Define to 1 if the system has the type `fsfilcnt_t'. */
|
||||
/* #undef HAVE_FSFILCNT_T */
|
||||
|
||||
/* Define to 1 if you have the `fstatfs' function. */
|
||||
/* #undef HAVE_FSTATFS */
|
||||
|
||||
/* Define to 1 if you have the `fstatvfs' function. */
|
||||
/* #undef HAVE_FSTATVFS */
|
||||
|
||||
/* Define to 1 if you have the <ft2build.h> header file. */
|
||||
/* #undef HAVE_FT2BUILD_H */
|
||||
|
||||
/* Define to 1 if you have the `ftruncate' function. */
|
||||
#define HAVE_FTRUNCATE 1
|
||||
|
||||
/* Define to 1 if you have the `futimes' function. */
|
||||
/* #undef HAVE_FUTIMES */
|
||||
|
||||
/* Define to 1 if you have the `gethostbyname' function. */
|
||||
/* #undef HAVE_GETHOSTBYNAME */
|
||||
|
||||
/* Define to 1 if you have the `getnetbyname' function. */
|
||||
/* #undef HAVE_GETNETBYNAME */
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
#define HAVE_GETOPT_H 1
|
||||
|
||||
/* Define to 1 if you have the `getopt_long' function. */
|
||||
#define HAVE_GETOPT_LONG 1
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
|
||||
/* Define to 1 if you have the `getprotobyname' function. */
|
||||
/* #undef HAVE_GETPROTOBYNAME */
|
||||
|
||||
/* Define to 1 if you have the `getprotobynumber' function. */
|
||||
/* #undef HAVE_GETPROTOBYNUMBER */
|
||||
|
||||
/* Define to 1 if you have the `getpwuid' function. */
|
||||
/* #undef HAVE_GETPWUID */
|
||||
|
||||
/* Define to 1 if you have the `getservbyport' function. */
|
||||
/* #undef HAVE_GETSERVBYPORT */
|
||||
|
||||
/* Define to 1 if you have the `gettid' function. */
|
||||
/* #undef HAVE_GETTID */
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
/* #undef HAVE_GETTIMEOFDAY */
|
||||
|
||||
/* Define to 1 if you have the `getuid' function. */
|
||||
/* #undef HAVE_GETUID */
|
||||
|
||||
/* Define to 1 if you have the <gif_lib.h> header file. */
|
||||
/* #undef HAVE_GIF_LIB_H */
|
||||
|
||||
/* Define to 1 if you have the <GL/glext.h> header file. */
|
||||
/* #undef HAVE_GL_GLEXT_H */
|
||||
|
||||
/* Define to 1 if you have the <GL/glx.h> header file. */
|
||||
/* #undef HAVE_GL_GLX_H */
|
||||
|
||||
/* Define to 1 if you have the <GL/gl.h> header file. */
|
||||
/* #undef HAVE_GL_GL_H */
|
||||
|
||||
/* Define to 1 if the ICU libraries are installed */
|
||||
/* #undef HAVE_ICU */
|
||||
|
||||
/* Define to 1 if you have the <ieeefp.h> header file. */
|
||||
/* #undef HAVE_IEEEFP_H */
|
||||
|
||||
/* Define to 1 if you have the `inet_aton' function. */
|
||||
/* #undef HAVE_INET_ATON */
|
||||
|
||||
/* Define to 1 if you have the `inet_network' function. */
|
||||
/* #undef HAVE_INET_NETWORK */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <io.h> header file. */
|
||||
#define HAVE_IO_H 1
|
||||
|
||||
/* Define if IPX should use netipx/ipx.h from libc */
|
||||
/* #undef HAVE_IPX_GNU */
|
||||
|
||||
/* Define if IPX includes are taken from Linux kernel */
|
||||
/* #undef HAVE_IPX_LINUX */
|
||||
|
||||
/* Define to 1 if you have the `iswalnum' function. */
|
||||
#define HAVE_ISWALNUM 1
|
||||
|
||||
/* Define to 1 if you have the <jack/jack.h> header file. */
|
||||
/* #undef HAVE_JACK_JACK_H */
|
||||
|
||||
/* Define to 1 if you have the <jpeglib.h> header file. */
|
||||
/* #undef HAVE_JPEGLIB_H */
|
||||
|
||||
/* Define to 1 if you have the <lcms.h> header file. */
|
||||
/* #undef HAVE_LCMS_H */
|
||||
|
||||
/* Define to 1 if you have the <lcms/lcms.h> header file. */
|
||||
/* #undef HAVE_LCMS_LCMS_H */
|
||||
|
||||
/* Define if you have libaudioIO */
|
||||
/* #undef HAVE_LIBAUDIOIO */
|
||||
|
||||
/* Define to 1 if you have the <libaudioio.h> header file. */
|
||||
/* #undef HAVE_LIBAUDIOIO_H */
|
||||
|
||||
/* Define if you have the curses library (-lcurses) */
|
||||
/* #undef HAVE_LIBCURSES */
|
||||
|
||||
/* Define to 1 if you have the `i386' library (-li386). */
|
||||
/* #undef HAVE_LIBI386 */
|
||||
|
||||
/* Define if you have the ncurses library (-lncurses) */
|
||||
/* #undef HAVE_LIBNCURSES */
|
||||
|
||||
/* Define to 1 if you have the `nsl' library (-lnsl). */
|
||||
/* #undef HAVE_LIBNSL */
|
||||
|
||||
/* Define to 1 if you have the `ossaudio' library (-lossaudio). */
|
||||
/* #undef HAVE_LIBOSSAUDIO */
|
||||
|
||||
/* Define to 1 if you have the `poll' library (-lpoll). */
|
||||
/* #undef HAVE_LIBPOLL */
|
||||
|
||||
/* Define to 1 if you have the `resolv' library (-lresolv). */
|
||||
/* #undef HAVE_LIBRESOLV */
|
||||
|
||||
/* Define to 1 if you have the `socket' library (-lsocket). */
|
||||
/* #undef HAVE_LIBSOCKET */
|
||||
|
||||
/* Define to 1 if you have the `w' library (-lw). */
|
||||
/* #undef HAVE_LIBW */
|
||||
|
||||
/* Define to 1 if you have the `xpg4' library (-lxpg4). */
|
||||
/* #undef HAVE_LIBXPG4 */
|
||||
|
||||
/* Define if you have the Xrandr library */
|
||||
/* #undef HAVE_LIBXRANDR */
|
||||
|
||||
/* Define if you have the X Shape extension */
|
||||
/* #undef HAVE_LIBXSHAPE */
|
||||
|
||||
/* Define if you have the Xxf86dga library version 2 */
|
||||
/* #undef HAVE_LIBXXF86DGA2 */
|
||||
|
||||
/* Define if you have the Xxf86vm library */
|
||||
/* #undef HAVE_LIBXXF86VM */
|
||||
|
||||
/* Define if you have the X Shm extension */
|
||||
/* #undef HAVE_LIBXXSHM */
|
||||
|
||||
/* Define to 1 if you have the <link.h> header file. */
|
||||
/* #undef HAVE_LINK_H */
|
||||
|
||||
/* Define if <linux/joystick.h> defines the Linux 2.2 joystick API */
|
||||
/* #undef HAVE_LINUX_22_JOYSTICK_API */
|
||||
|
||||
/* Define to 1 if you have the <linux/capi.h> header file. */
|
||||
/* #undef HAVE_LINUX_CAPI_H */
|
||||
|
||||
/* Define to 1 if you have the <linux/cdrom.h> header file. */
|
||||
/* #undef HAVE_LINUX_CDROM_H */
|
||||
|
||||
/* Define to 1 if you have the <linux/compiler.h> header file. */
|
||||
/* #undef HAVE_LINUX_COMPILER_H */
|
||||
|
||||
/* Define if Linux-style gethostbyname_r and gethostbyaddr_r are available */
|
||||
/* #undef HAVE_LINUX_GETHOSTBYNAME_R_6 */
|
||||
|
||||
/* Define to 1 if you have the <linux/hdreg.h> header file. */
|
||||
/* #undef HAVE_LINUX_HDREG_H */
|
||||
|
||||
/* Define to 1 if you have the <linux/input.h> header file. */
|
||||
/* #undef HAVE_LINUX_INPUT_H */
|
||||
|
||||
/* Define to 1 if you have the <linux/ioctl.h> header file. */
|
||||
/* #undef HAVE_LINUX_IOCTL_H */
|
||||
|
||||
/* Define to 1 if you have the <linux/joystick.h> header file. */
|
||||
/* #undef HAVE_LINUX_JOYSTICK_H */
|
||||
|
||||
/* Define to 1 if you have the <linux/major.h> header file. */
|
||||
/* #undef HAVE_LINUX_MAJOR_H */
|
||||
|
||||
/* Define to 1 if you have the <linux/param.h> header file. */
|
||||
/* #undef HAVE_LINUX_PARAM_H */
|
||||
|
||||
/* Define to 1 if you have the <linux/serial.h> header file. */
|
||||
/* #undef HAVE_LINUX_SERIAL_H */
|
||||
|
||||
/* Define to 1 if you have the <linux/ucdrom.h> header file. */
|
||||
/* #undef HAVE_LINUX_UCDROM_H */
|
||||
|
||||
/* Define to 1 if the system has the type `long long'. */
|
||||
#define HAVE_LONG_LONG 1
|
||||
|
||||
/* Define to 1 if you have the `lstat' function. */
|
||||
/* #undef HAVE_LSTAT */
|
||||
|
||||
/* Define to 1 if you have the <machine/cpu.h> header file. */
|
||||
/* #undef HAVE_MACHINE_CPU_H */
|
||||
|
||||
/* Define to 1 if you have the <machine/soundcard.h> header file. */
|
||||
/* #undef HAVE_MACHINE_SOUNDCARD_H */
|
||||
|
||||
/* Define to 1 if you have the `memmove' function. */
|
||||
#define HAVE_MEMMOVE 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `mmap' function. */
|
||||
/* #undef HAVE_MMAP */
|
||||
|
||||
/* Define to 1 if you have the <mntent.h> header file. */
|
||||
/* #undef HAVE_MNTENT_H */
|
||||
|
||||
/* Define to 1 if the system has the type `mode_t'. */
|
||||
#define HAVE_MODE_T 1
|
||||
|
||||
/* Define if you have NAS including devel headers */
|
||||
/* #undef HAVE_NAS */
|
||||
|
||||
/* Define to 1 if you have the <ncurses.h> header file. */
|
||||
/* #undef HAVE_NCURSES_H */
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
/* #undef HAVE_NETDB_H */
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
/* #undef HAVE_NETINET_IN_H */
|
||||
|
||||
/* Define to 1 if you have the <netinet/in_systm.h> header file. */
|
||||
/* #undef HAVE_NETINET_IN_SYSTM_H */
|
||||
|
||||
/* Define to 1 if you have the <netinet/tcp_fsm.h> header file. */
|
||||
/* #undef HAVE_NETINET_TCP_FSM_H */
|
||||
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */
|
||||
/* #undef HAVE_NETINET_TCP_H */
|
||||
|
||||
/* Define to 1 if you have the <net/if_arp.h> header file. */
|
||||
/* #undef HAVE_NET_IF_ARP_H */
|
||||
|
||||
/* Define to 1 if you have the <net/if_dl.h> header file. */
|
||||
/* #undef HAVE_NET_IF_DL_H */
|
||||
|
||||
/* Define to 1 if you have the <net/if.h> header file. */
|
||||
/* #undef HAVE_NET_IF_H */
|
||||
|
||||
/* Define to 1 if you have the <net/if_types.h> header file. */
|
||||
/* #undef HAVE_NET_IF_TYPES_H */
|
||||
|
||||
/* Define to 1 if you have the <net/route.h> header file. */
|
||||
/* #undef HAVE_NET_ROUTE_H */
|
||||
|
||||
/* Define to 1 if the system has the type `off_t'. */
|
||||
#define HAVE_OFF_T 1
|
||||
|
||||
/* Define if OpenGL is present on the system */
|
||||
/* #undef HAVE_OPENGL */
|
||||
|
||||
/* Define to 1 if you have the <openssl/ssl.h> header file. */
|
||||
/* #undef HAVE_OPENSSL_SSL_H */
|
||||
|
||||
/* Define if you have the Open Sound system */
|
||||
/* #undef HAVE_OSS */
|
||||
|
||||
/* Define if you have the Open Sound system (MIDI interface) */
|
||||
/* #undef HAVE_OSS_MIDI */
|
||||
|
||||
/* Define to 1 if you have the `pclose' function. */
|
||||
#define HAVE_PCLOSE 1
|
||||
|
||||
/* Define to 1 if the system has the type `pid_t'. */
|
||||
#define HAVE_PID_T 1
|
||||
|
||||
/* Define to 1 if you have the `popen' function. */
|
||||
#define HAVE_POPEN 1
|
||||
|
||||
/* Define if we can use ppdev.h for parallel port access */
|
||||
/* #undef HAVE_PPDEV */
|
||||
|
||||
/* Define to 1 if you have the `pread' function. */
|
||||
/* #undef HAVE_PREAD */
|
||||
|
||||
/* Define to 1 if you have the <process.h> header file. */
|
||||
#define HAVE_PROCESS_H 1
|
||||
|
||||
/* Define to 1 if you have the `pthread_getattr_np' function. */
|
||||
/* #undef HAVE_PTHREAD_GETATTR_NP */
|
||||
|
||||
/* Define to 1 if you have the `pthread_get_stackaddr_np' function. */
|
||||
/* #undef HAVE_PTHREAD_GET_STACKADDR_NP */
|
||||
|
||||
/* Define to 1 if you have the `pthread_get_stacksize_np' function. */
|
||||
/* #undef HAVE_PTHREAD_GET_STACKSIZE_NP */
|
||||
|
||||
/* Define to 1 if you have the <pthread.h> header file. */
|
||||
/* #undef HAVE_PTHREAD_H */
|
||||
|
||||
/* Define to 1 if the system has the type `pthread_rwlockattr_t'. */
|
||||
/* #undef HAVE_PTHREAD_RWLOCKATTR_T */
|
||||
|
||||
/* Define to 1 if the system has the type `pthread_rwlock_t'. */
|
||||
/* #undef HAVE_PTHREAD_RWLOCK_T */
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
/* #undef HAVE_PWD_H */
|
||||
|
||||
/* Define to 1 if you have the `pwrite' function. */
|
||||
/* #undef HAVE_PWRITE */
|
||||
|
||||
/* Define to 1 if you have the `readlink' function. */
|
||||
/* #undef HAVE_READLINK */
|
||||
|
||||
/* Define to 1 if you have the <regex.h> header file. */
|
||||
/* #undef HAVE_REGEX_H */
|
||||
|
||||
/* Define to 1 if you have the <resolv.h> header file. */
|
||||
/* #undef HAVE_RESOLV_H */
|
||||
|
||||
/* Define to 1 if you have the `rfork' function. */
|
||||
/* #undef HAVE_RFORK */
|
||||
|
||||
/* Define if we have SANE development environment */
|
||||
/* #undef HAVE_SANE */
|
||||
|
||||
/* Define to 1 if you have the <sched.h> header file. */
|
||||
/* #undef HAVE_SCHED_H */
|
||||
|
||||
/* Define to 1 if you have the `sched_yield' function. */
|
||||
/* #undef HAVE_SCHED_YIELD */
|
||||
|
||||
/* Define to 1 if you have the <scsi/scsi.h> header file. */
|
||||
/* #undef HAVE_SCSI_SCSI_H */
|
||||
|
||||
/* Define to 1 if you have the <scsi/scsi_ioctl.h> header file. */
|
||||
/* #undef HAVE_SCSI_SCSI_IOCTL_H */
|
||||
|
||||
/* Define to 1 if you have the <scsi/sg.h> header file. */
|
||||
/* #undef HAVE_SCSI_SG_H */
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
/* #undef HAVE_SELECT */
|
||||
|
||||
/* Define to 1 if you have the `sendmsg' function. */
|
||||
/* #undef HAVE_SENDMSG */
|
||||
|
||||
/* Define to 1 if you have the `settimeofday' function. */
|
||||
/* #undef HAVE_SETTIMEOFDAY */
|
||||
|
||||
/* Define if sigaddset is supported */
|
||||
/* #undef HAVE_SIGADDSET */
|
||||
|
||||
/* Define to 1 if you have the `sigaltstack' function. */
|
||||
/* #undef HAVE_SIGALTSTACK */
|
||||
|
||||
/* Define to 1 if `si_fd' is member of `siginfo_t'. */
|
||||
/* #undef HAVE_SIGINFO_T_SI_FD */
|
||||
|
||||
/* Define to 1 if you have the `sigprocmask' function. */
|
||||
/* #undef HAVE_SIGPROCMASK */
|
||||
|
||||
/* Define to 1 if you have the sigsetjmp (and siglongjmp) function */
|
||||
/* #undef HAVE_SIGSETJMP */
|
||||
|
||||
/* Define to 1 if the system has the type `sigset_t'. */
|
||||
/* #undef HAVE_SIGSET_T */
|
||||
|
||||
/* Define to 1 if the system has the type `size_t'. */
|
||||
#define HAVE_SIZE_T 1
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the <soundcard.h> header file. */
|
||||
/* #undef HAVE_SOUNDCARD_H */
|
||||
|
||||
/* Define to 1 if you have the `spawnvp' function. */
|
||||
#define HAVE_SPAWNVP 1
|
||||
|
||||
/* Define to 1 if the system has the type `ssize_t'. */
|
||||
#define HAVE_SSIZE_T 1
|
||||
|
||||
/* Define to 1 if you have the `statfs' function. */
|
||||
/* #undef HAVE_STATFS */
|
||||
|
||||
/* Define to 1 if you have the `statvfs' function. */
|
||||
/* #undef HAVE_STATVFS */
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strncasecmp' function. */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
|
||||
/* Define to 1 if `msg_accrights' is member of `struct msghdr'. */
|
||||
/* #undef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
|
||||
|
||||
/* Define to 1 if `name' is member of `struct option'. */
|
||||
#define HAVE_STRUCT_OPTION_NAME 1
|
||||
|
||||
/* Define to 1 if `sa_len' is member of `struct sockaddr'. */
|
||||
/* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */
|
||||
|
||||
/* Define to 1 if `sun_len' is member of `struct sockaddr_un'. */
|
||||
/* #undef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
|
||||
|
||||
/* Define to 1 if `f_bavail' is member of `struct statfs'. */
|
||||
/* #undef HAVE_STRUCT_STATFS_F_BAVAIL */
|
||||
|
||||
/* Define to 1 if `f_bfree' is member of `struct statfs'. */
|
||||
/* #undef HAVE_STRUCT_STATFS_F_BFREE */
|
||||
|
||||
/* Define to 1 if `f_favail' is member of `struct statfs'. */
|
||||
/* #undef HAVE_STRUCT_STATFS_F_FAVAIL */
|
||||
|
||||
/* Define to 1 if `f_ffree' is member of `struct statfs'. */
|
||||
/* #undef HAVE_STRUCT_STATFS_F_FFREE */
|
||||
|
||||
/* Define to 1 if `f_frsize' is member of `struct statfs'. */
|
||||
/* #undef HAVE_STRUCT_STATFS_F_FRSIZE */
|
||||
|
||||
/* Define to 1 if `f_namelen' is member of `struct statfs'. */
|
||||
/* #undef HAVE_STRUCT_STATFS_F_NAMELEN */
|
||||
|
||||
/* Define to 1 if `f_blocks' is member of `struct statvfs'. */
|
||||
/* #undef HAVE_STRUCT_STATVFS_F_BLOCKS */
|
||||
|
||||
/* Define to 1 if `st_blocks' is member of `struct stat'. */
|
||||
/* #undef HAVE_STRUCT_STAT_ST_BLOCKS */
|
||||
|
||||
/* Define to 1 if you have the <syscall.h> header file. */
|
||||
/* #undef HAVE_SYSCALL_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/asoundlib.h> header file. */
|
||||
/* #undef HAVE_SYS_ASOUNDLIB_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/cdio.h> header file. */
|
||||
/* #undef HAVE_SYS_CDIO_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/elf32.h> header file. */
|
||||
/* #undef HAVE_SYS_ELF32_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/epoll.h> header file. */
|
||||
/* #undef HAVE_SYS_EPOLL_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/errno.h> header file. */
|
||||
/* #undef HAVE_SYS_ERRNO_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/exec_elf.h> header file. */
|
||||
/* #undef HAVE_SYS_EXEC_ELF_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/filio.h> header file. */
|
||||
/* #undef HAVE_SYS_FILIO_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
/* #undef HAVE_SYS_IOCTL_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/ipc.h> header file. */
|
||||
/* #undef HAVE_SYS_IPC_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/link.h> header file. */
|
||||
/* #undef HAVE_SYS_LINK_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/lwp.h> header file. */
|
||||
/* #undef HAVE_SYS_LWP_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||
/* #undef HAVE_SYS_MMAN_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/modem.h> header file. */
|
||||
/* #undef HAVE_SYS_MODEM_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/mount.h> header file. */
|
||||
/* #undef HAVE_SYS_MOUNT_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/msg.h> header file. */
|
||||
/* #undef HAVE_SYS_MSG_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/poll.h> header file. */
|
||||
/* #undef HAVE_SYS_POLL_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/ptrace.h> header file. */
|
||||
/* #undef HAVE_SYS_PTRACE_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/reg.h> header file. */
|
||||
/* #undef HAVE_SYS_REG_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/scsiio.h> header file. */
|
||||
/* #undef HAVE_SYS_SCSIIO_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/shm.h> header file. */
|
||||
/* #undef HAVE_SYS_SHM_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/signal.h> header file. */
|
||||
/* #undef HAVE_SYS_SIGNAL_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
/* #undef HAVE_SYS_SOCKET_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/sockio.h> header file. */
|
||||
/* #undef HAVE_SYS_SOCKIO_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/soundcard.h> header file. */
|
||||
/* #undef HAVE_SYS_SOUNDCARD_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/statfs.h> header file. */
|
||||
/* #undef HAVE_SYS_STATFS_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/statvfs.h> header file. */
|
||||
/* #undef HAVE_SYS_STATVFS_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/strtio.h> header file. */
|
||||
/* #undef HAVE_SYS_STRTIO_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/syscall.h> header file. */
|
||||
/* #undef HAVE_SYS_SYSCALL_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/sysctl.h> header file. */
|
||||
/* #undef HAVE_SYS_SYSCTL_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/times.h> header file. */
|
||||
/* #undef HAVE_SYS_TIMES_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */
|
||||
/* #undef HAVE_SYS_UIO_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/un.h> header file. */
|
||||
/* #undef HAVE_SYS_UN_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/user.h> header file. */
|
||||
/* #undef HAVE_SYS_USER_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/vfs.h> header file. */
|
||||
/* #undef HAVE_SYS_VFS_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/vm86.h> header file. */
|
||||
/* #undef HAVE_SYS_VM86_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/wait.h> header file. */
|
||||
/* #undef HAVE_SYS_WAIT_H */
|
||||
|
||||
/* Define to 1 if you have the `tcgetattr' function. */
|
||||
/* #undef HAVE_TCGETATTR */
|
||||
|
||||
/* Define to 1 if you have the <termios.h> header file. */
|
||||
/* #undef HAVE_TERMIOS_H */
|
||||
|
||||
/* Define to 1 if you have the `timegm' function. */
|
||||
/* #undef HAVE_TIMEGM */
|
||||
|
||||
/* Define to 1 if you have the <ucontext.h> header file. */
|
||||
/* #undef HAVE_UCONTEXT_H */
|
||||
|
||||
/* Define to 1 if you have the <unicode/ubidi.h> header file. */
|
||||
/* #undef HAVE_UNICODE_UBIDI_H */
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
/* #undef HAVE_USLEEP */
|
||||
|
||||
/* Define to 1 if you have the <utime.h> header file. */
|
||||
#define HAVE_UTIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <valgrind/memcheck.h> header file. */
|
||||
/* #undef HAVE_VALGRIND_MEMCHECK_H */
|
||||
|
||||
/* Define if we have va_copy */
|
||||
#define HAVE_VA_COPY 1
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `wait4' function. */
|
||||
/* #undef HAVE_WAIT4 */
|
||||
|
||||
/* Define to 1 if you have the `waitpid' function. */
|
||||
/* #undef HAVE_WAITPID */
|
||||
|
||||
/* Define to 1 if you have the <X11/extensions/shape.h> header file. */
|
||||
/* #undef HAVE_X11_EXTENSIONS_SHAPE_H */
|
||||
|
||||
/* Define to 1 if you have the <X11/extensions/xf86dga.h> header file. */
|
||||
/* #undef HAVE_X11_EXTENSIONS_XF86DGA_H */
|
||||
|
||||
/* Define to 1 if you have the <X11/extensions/xf86vmode.h> header file. */
|
||||
/* #undef HAVE_X11_EXTENSIONS_XF86VMODE_H */
|
||||
|
||||
/* Define to 1 if you have the <X11/extensions/XInput.h> header file. */
|
||||
/* #undef HAVE_X11_EXTENSIONS_XINPUT_H */
|
||||
|
||||
/* Define to 1 if you have the <X11/extensions/Xrandr.h> header file. */
|
||||
/* #undef HAVE_X11_EXTENSIONS_XRANDR_H */
|
||||
|
||||
/* Define to 1 if you have the <X11/extensions/Xrender.h> header file. */
|
||||
/* #undef HAVE_X11_EXTENSIONS_XRENDER_H */
|
||||
|
||||
/* Define to 1 if you have the <X11/extensions/XShm.h> header file. */
|
||||
/* #undef HAVE_X11_EXTENSIONS_XSHM_H */
|
||||
|
||||
/* Define to 1 if you have the <X11/XKBlib.h> header file. */
|
||||
/* #undef HAVE_X11_XKBLIB_H */
|
||||
|
||||
/* Define to 1 if you have the <X11/Xlib.h> header file. */
|
||||
/* #undef HAVE_X11_XLIB_H */
|
||||
|
||||
/* Define to 1 if you have the <X11/Xutil.h> header file. */
|
||||
/* #undef HAVE_X11_XUTIL_H */
|
||||
|
||||
/* Define if you have the XKB extension */
|
||||
/* #undef HAVE_XKB */
|
||||
|
||||
/* Define if Xrender has the XRenderSetPictureTransform function */
|
||||
/* #undef HAVE_XRENDERSETPICTURETRANSFORM */
|
||||
|
||||
/* Define to 1 if you have the `_lwp_create' function. */
|
||||
/* #undef HAVE__LWP_CREATE */
|
||||
|
||||
/* Define to 1 if you have the `_lwp_self' function. */
|
||||
/* #undef HAVE__LWP_SELF */
|
||||
|
||||
/* Define to 1 if you have the `_pclose' function. */
|
||||
#define HAVE__PCLOSE 1
|
||||
|
||||
/* Define to 1 if you have the `_popen' function. */
|
||||
#define HAVE__POPEN 1
|
||||
|
||||
/* Define to 1 if you have the `_snprintf' function. */
|
||||
#define HAVE__SNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `_spawnvp' function. */
|
||||
#define HAVE__SPAWNVP 1
|
||||
|
||||
/* Define to 1 if you have the `_stricmp' function. */
|
||||
#define HAVE__STRICMP 1
|
||||
|
||||
/* Define to 1 if you have the `_strnicmp' function. */
|
||||
#define HAVE__STRNICMP 1
|
||||
|
||||
/* Define to 1 if you have the `_vsnprintf' function. */
|
||||
#define HAVE__VSNPRINTF 1
|
||||
|
||||
/* Define if we have __va_copy */
|
||||
#define HAVE___VA_COPY 1
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "wine-devel@winehq.org"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "Wine"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "Wine 20050211"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "wine"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "20050211"
|
||||
|
||||
/* Define to the soname of the libcapi20 library. */
|
||||
/* #undef SONAME_LIBCAPI20 */
|
||||
|
||||
/* Define to the soname of the libcrypto library. */
|
||||
/* #undef SONAME_LIBCRYPTO */
|
||||
|
||||
/* Define to the soname of the libcups library. */
|
||||
/* #undef SONAME_LIBCUPS */
|
||||
|
||||
/* Define to the soname of the libcurses library. */
|
||||
/* #undef SONAME_LIBCURSES */
|
||||
|
||||
/* Define to the soname of the libfontconfig library. */
|
||||
/* #undef SONAME_LIBFONTCONFIG */
|
||||
|
||||
/* Define to the soname of the libfreetype library. */
|
||||
/* #undef SONAME_LIBFREETYPE */
|
||||
|
||||
/* Define to the soname of the libgif library. */
|
||||
/* #undef SONAME_LIBGIF */
|
||||
|
||||
/* Define to the soname of the libGL library. */
|
||||
/* #undef SONAME_LIBGL */
|
||||
|
||||
/* Define to the soname of the libjack library. */
|
||||
/* #undef SONAME_LIBJACK */
|
||||
|
||||
/* Define to the soname of the libjpeg library. */
|
||||
/* #undef SONAME_LIBJPEG */
|
||||
|
||||
/* Define to the soname of the liblcms library. */
|
||||
/* #undef SONAME_LIBLCMS */
|
||||
|
||||
/* Define to the soname of the libncurses library. */
|
||||
/* #undef SONAME_LIBNCURSES */
|
||||
|
||||
/* Define to the soname of the libssl library. */
|
||||
/* #undef SONAME_LIBSSL */
|
||||
|
||||
/* Define to the soname of the libtxc_dxtn library. */
|
||||
/* #undef SONAME_LIBTXC_DXTN */
|
||||
|
||||
/* Define to the soname of the libungif library. */
|
||||
/* #undef SONAME_LIBUNGIF */
|
||||
|
||||
/* Define to the soname of the libX11 library. */
|
||||
/* #undef SONAME_LIBX11 */
|
||||
|
||||
/* Define to the soname of the libXext library. */
|
||||
/* #undef SONAME_LIBXEXT */
|
||||
|
||||
/* Define to the soname of the libXi library. */
|
||||
/* #undef SONAME_LIBXI */
|
||||
|
||||
/* Define to the soname of the libXrandr library. */
|
||||
/* #undef SONAME_LIBXRANDR */
|
||||
|
||||
/* Define to the soname of the libXrender library. */
|
||||
/* #undef SONAME_LIBXRENDER */
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
/* #undef STACK_DIRECTION */
|
||||
|
||||
/* Define if the struct statfs is defined by <sys/mount.h> */
|
||||
/* #undef STATFS_DEFINED_BY_SYS_MOUNT */
|
||||
|
||||
/* Define if the struct statfs is defined by <sys/statfs.h> */
|
||||
/* #undef STATFS_DEFINED_BY_SYS_STATFS */
|
||||
|
||||
/* Define if the struct statfs is defined by <sys/vfs.h> */
|
||||
/* #undef STATFS_DEFINED_BY_SYS_VFS */
|
||||
|
||||
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||
/* #undef STAT_MACROS_BROKEN */
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define to 1 if the X Window System is missing or not being used. */
|
||||
#define X_DISPLAY_MISSING 1
|
||||
|
||||
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
|
||||
`char[]'. */
|
||||
#define YYTEXT_POINTER 1
|
||||
|
||||
/* Set this to 64 to enable 64-bit file support on Linux */
|
||||
/* #undef _FILE_OFFSET_BITS */
|
||||
|
||||
/* Define to a macro to generate an assembly function directive */
|
||||
#define __ASM_FUNC(name) ".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef"
|
||||
|
||||
/* Define to a macro to generate an assembly name from a C symbol */
|
||||
#define __ASM_NAME(name) "_" name
|
||||
|
||||
/* Define to the assembler keyword used to specify a word value */
|
||||
#define __ASM_SHORT ".short"
|
||||
|
||||
/* Define to the assembler keyword used to specify an ASCII string */
|
||||
#define __ASM_STRING ".string"
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
/* #undef inline */
|
||||
#endif
|
@@ -1,35 +1,25 @@
|
||||
/*
|
||||
* Ritch Edit 20 class extra info
|
||||
*
|
||||
* Copyright 2004 CodeWeavers (Aric Stewart)
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RICHED20_H
|
||||
#define __WINE_RICHED20_H
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "richedit.h"
|
||||
|
||||
extern VOID RICHED20_Register (VOID);
|
||||
extern VOID RICHED20_Unregister (VOID);
|
||||
|
||||
#endif /* __WINE_RICHED20_H */
|
||||
/*
|
||||
* Resources for the binary we distribute to testers
|
||||
*
|
||||
* Copyright 2004 Ferenc Wagner
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "winetest.rc"
|
||||
|
||||
WINE_BUILD STRINGRES "build.id"
|
||||
BUILD_INFO STRINGRES "build.nfo"
|
||||
TESTS_URL STRINGRES "tests.url"
|
473
reactos/apps/utils/winetest/gui.c
Normal file
473
reactos/apps/utils/winetest/gui.c
Normal file
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
* GUI support
|
||||
*
|
||||
* Copyright 2004 Ferenc Wagner
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "resource.h"
|
||||
#include "winetest.h"
|
||||
|
||||
/* Event object to signal successful window creation to main thread.
|
||||
*/
|
||||
HANDLE initEvent;
|
||||
|
||||
/* Dialog handle
|
||||
*/
|
||||
HWND dialog;
|
||||
|
||||
/* Progress data for the text* functions and for scaling.
|
||||
*/
|
||||
unsigned int progressMax, progressCurr;
|
||||
double progressScale;
|
||||
|
||||
/* Progress group counter for the gui* functions.
|
||||
*/
|
||||
int progressGroup;
|
||||
|
||||
char *
|
||||
renderString (va_list ap)
|
||||
{
|
||||
const char *fmt = va_arg (ap, char*);
|
||||
static char buffer[128];
|
||||
|
||||
vsnprintf (buffer, sizeof buffer, fmt, ap);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
int
|
||||
MBdefault (int uType)
|
||||
{
|
||||
static const int matrix[][4] = {{IDOK, 0, 0, 0},
|
||||
{IDOK, IDCANCEL, 0, 0},
|
||||
{IDABORT, IDRETRY, IDIGNORE, 0},
|
||||
{IDYES, IDNO, IDCANCEL, 0},
|
||||
{IDYES, IDNO, 0, 0},
|
||||
{IDRETRY, IDCANCEL, 0, 0}};
|
||||
int type = uType & MB_TYPEMASK;
|
||||
int def = (uType & MB_DEFMASK) / MB_DEFBUTTON2;
|
||||
|
||||
return matrix[type][def];
|
||||
}
|
||||
|
||||
/* report (R_STATUS, fmt, ...) */
|
||||
int
|
||||
textStatus (va_list ap)
|
||||
{
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
fputs (str, stderr);
|
||||
fputc ('\n', stderr);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
guiStatus (va_list ap)
|
||||
{
|
||||
size_t len;
|
||||
char *str = vstrmake (&len, ap);
|
||||
|
||||
if (len > 128) str[129] = 0;
|
||||
SetDlgItemText (dialog, IDC_SB, str);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* report (R_PROGRESS, barnum, steps) */
|
||||
int
|
||||
textProgress (va_list ap)
|
||||
{
|
||||
progressGroup = va_arg (ap, int);
|
||||
progressMax = va_arg (ap, int);
|
||||
progressCurr = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
guiProgress (va_list ap)
|
||||
{
|
||||
unsigned int max;
|
||||
HWND pb;
|
||||
|
||||
progressGroup = va_arg (ap, int);
|
||||
progressMax = max = va_arg (ap, int);
|
||||
progressCurr = 0;
|
||||
if (max > 0xffff) {
|
||||
progressScale = (double)0xffff / max;
|
||||
max = 0xffff;
|
||||
}
|
||||
else progressScale = 1;
|
||||
pb = GetDlgItem (dialog, IDC_PB0 + progressGroup * 2);
|
||||
SendMessage (pb, PBM_SETRANGE, 0, MAKELPARAM (0, max));
|
||||
SendMessage (pb, PBM_SETSTEP, (WPARAM)1, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* report (R_STEP, fmt, ...) */
|
||||
int
|
||||
textStep (va_list ap)
|
||||
{
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
progressCurr++;
|
||||
fputs (str, stderr);
|
||||
fprintf (stderr, " (%d of %d)\n", progressCurr, progressMax);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
guiStep (va_list ap)
|
||||
{
|
||||
const int pgID = IDC_ST0 + progressGroup * 2;
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
progressCurr++;
|
||||
SetDlgItemText (dialog, pgID, str);
|
||||
SendDlgItemMessage (dialog, pgID+1, PBM_SETPOS,
|
||||
(WPARAM)(progressScale * progressCurr), 0);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* report (R_DELTA, inc, fmt, ...) */
|
||||
int
|
||||
textDelta (va_list ap)
|
||||
{
|
||||
const int inc = va_arg (ap, int);
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
progressCurr += inc;
|
||||
fputs (str, stderr);
|
||||
fprintf (stderr, " (%d of %d)\n", progressCurr, progressMax);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
guiDelta (va_list ap)
|
||||
{
|
||||
const int inc = va_arg (ap, int);
|
||||
const int pgID = IDC_ST0 + progressGroup * 2;
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
progressCurr += inc;
|
||||
SetDlgItemText (dialog, pgID, str);
|
||||
SendDlgItemMessage (dialog, pgID+1, PBM_SETPOS,
|
||||
(WPARAM)(progressScale * progressCurr), 0);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* report (R_DIR, fmt, ...) */
|
||||
int
|
||||
textDir (va_list ap)
|
||||
{
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
fputs ("Temporary directory: ", stderr);
|
||||
fputs (str, stderr);
|
||||
fputc ('\n', stderr);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
guiDir (va_list ap)
|
||||
{
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
SetDlgItemText (dialog, IDC_DIR, str);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* report (R_OUT, fmt, ...) */
|
||||
int
|
||||
textOut (va_list ap)
|
||||
{
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
fputs ("Log file: ", stderr);
|
||||
fputs (str, stderr);
|
||||
fputc ('\n', stderr);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
guiOut (va_list ap)
|
||||
{
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
SetDlgItemText (dialog, IDC_OUT, str);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* report (R_WARNING, fmt, ...) */
|
||||
int
|
||||
textWarning (va_list ap)
|
||||
{
|
||||
fputs ("Warning: ", stderr);
|
||||
textStatus (ap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
guiWarning (va_list ap)
|
||||
{
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
MessageBox (dialog, str, "Warning", MB_ICONWARNING | MB_OK);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* report (R_ERROR, fmt, ...) */
|
||||
int
|
||||
textError (va_list ap)
|
||||
{
|
||||
fputs ("Error: ", stderr);
|
||||
textStatus (ap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
guiError (va_list ap)
|
||||
{
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
MessageBox (dialog, str, "Error", MB_ICONERROR | MB_OK);
|
||||
free (str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* report (R_FATAL, fmt, ...) */
|
||||
int
|
||||
textFatal (va_list ap)
|
||||
{
|
||||
textError (ap);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
int
|
||||
guiFatal (va_list ap)
|
||||
{
|
||||
guiError (ap);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* report (R_ASK, type, fmt, ...) */
|
||||
int
|
||||
textAsk (va_list ap)
|
||||
{
|
||||
int uType = va_arg (ap, int);
|
||||
int ret = MBdefault (uType);
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
fprintf (stderr, "Question of type %d: %s\n"
|
||||
"Returning default: %d\n", uType, str, ret);
|
||||
free (str);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
guiAsk (va_list ap)
|
||||
{
|
||||
int uType = va_arg (ap, int);
|
||||
char *str = vstrmake (NULL, ap);
|
||||
int ret = MessageBox (dialog, str, "Question",
|
||||
MB_ICONQUESTION | uType);
|
||||
|
||||
free (str);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Quiet functions */
|
||||
int
|
||||
qNoOp (va_list ap)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
qFatal (va_list ap)
|
||||
{
|
||||
exit (1);
|
||||
}
|
||||
|
||||
int
|
||||
qAsk (va_list ap)
|
||||
{
|
||||
return MBdefault (va_arg (ap, int));
|
||||
}
|
||||
|
||||
BOOL CALLBACK
|
||||
AboutProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD (wParam)) {
|
||||
case IDCANCEL:
|
||||
EndDialog (hwnd, IDCANCEL);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CALLBACK
|
||||
DlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
SendMessage (hwnd, WM_SETICON, ICON_SMALL,
|
||||
(LPARAM)LoadIcon (GetModuleHandle (NULL),
|
||||
MAKEINTRESOURCE (IDI_WINE)));
|
||||
SendMessage (hwnd, WM_SETICON, ICON_BIG,
|
||||
(LPARAM)LoadIcon (GetModuleHandle (NULL),
|
||||
MAKEINTRESOURCE (IDI_WINE)));
|
||||
dialog = hwnd;
|
||||
if (!SetEvent (initEvent)) {
|
||||
report (R_STATUS, "Can't signal main thread: %d",
|
||||
GetLastError ());
|
||||
EndDialog (hwnd, 2);
|
||||
}
|
||||
return TRUE;
|
||||
case WM_CLOSE:
|
||||
EndDialog (hwnd, 3);
|
||||
return TRUE;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD (wParam)) {
|
||||
case IDHELP:
|
||||
DialogBox (GetModuleHandle (NULL),
|
||||
MAKEINTRESOURCE (IDD_ABOUT), hwnd, AboutProc);
|
||||
return TRUE;
|
||||
case IDABORT:
|
||||
report (R_WARNING, "Not implemented");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DWORD WINAPI
|
||||
DlgThreadProc ()
|
||||
{
|
||||
int ret;
|
||||
|
||||
InitCommonControls ();
|
||||
ret = DialogBox (GetModuleHandle (NULL),
|
||||
MAKEINTRESOURCE (IDD_STATUS),
|
||||
NULL, DlgProc);
|
||||
switch (ret) {
|
||||
case 0:
|
||||
report (R_WARNING, "Invalid parent handle");
|
||||
break;
|
||||
case 1:
|
||||
report (R_WARNING, "DialogBox failed: %d",
|
||||
GetLastError ());
|
||||
break;
|
||||
case 3:
|
||||
exit (0);
|
||||
default:
|
||||
report (R_STATUS, "Dialog exited: %d", ret);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
report (enum report_type t, ...)
|
||||
{
|
||||
typedef int r_fun_t (va_list);
|
||||
|
||||
va_list ap;
|
||||
int ret = 0;
|
||||
static r_fun_t * const text_funcs[] =
|
||||
{textStatus, textProgress, textStep, textDelta,
|
||||
textDir, textOut,
|
||||
textWarning, textError, textFatal, textAsk};
|
||||
static r_fun_t * const GUI_funcs[] =
|
||||
{guiStatus, guiProgress, guiStep, guiDelta,
|
||||
guiDir, guiOut,
|
||||
guiWarning, guiError, guiFatal, guiAsk};
|
||||
static r_fun_t * const quiet_funcs[] =
|
||||
{qNoOp, qNoOp, qNoOp, qNoOp,
|
||||
qNoOp, qNoOp,
|
||||
qNoOp, qNoOp, qFatal, qAsk};
|
||||
static r_fun_t * const * funcs = NULL;
|
||||
|
||||
switch (t) {
|
||||
case R_TEXTMODE:
|
||||
funcs = text_funcs;
|
||||
return 0;
|
||||
case R_QUIET:
|
||||
funcs = quiet_funcs;
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!funcs) {
|
||||
HANDLE DlgThread;
|
||||
DWORD DlgThreadID;
|
||||
|
||||
funcs = text_funcs;
|
||||
initEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
|
||||
if (!initEvent)
|
||||
report (R_STATUS, "Can't create event object: %d",
|
||||
GetLastError ());
|
||||
else {
|
||||
DlgThread = CreateThread (NULL, 0, DlgThreadProc,
|
||||
NULL, 0, &DlgThreadID);
|
||||
if (!DlgThread)
|
||||
report (R_STATUS, "Can't create GUI thread: %d",
|
||||
GetLastError ());
|
||||
else {
|
||||
DWORD ret = WaitForSingleObject (initEvent, INFINITE);
|
||||
switch (ret) {
|
||||
case WAIT_OBJECT_0:
|
||||
funcs = GUI_funcs;
|
||||
break;
|
||||
case WAIT_TIMEOUT:
|
||||
report (R_STATUS, "GUI creation timed out");
|
||||
break;
|
||||
case WAIT_FAILED:
|
||||
report (R_STATUS, "Wait for GUI failed: %d",
|
||||
GetLastError ());
|
||||
break;
|
||||
default:
|
||||
report (R_STATUS, "Wait returned %d",
|
||||
ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
va_start (ap, t);
|
||||
if (t < sizeof text_funcs / sizeof text_funcs[0] &&
|
||||
t < sizeof GUI_funcs / sizeof GUI_funcs[0] &&
|
||||
t >= 0) ret = funcs[t](ap);
|
||||
else report (R_WARNING, "unimplemented report type: %d", t);
|
||||
va_end (ap);
|
||||
return ret;
|
||||
}
|
621
reactos/apps/utils/winetest/main.c
Normal file
621
reactos/apps/utils/winetest/main.c
Normal file
@@ -0,0 +1,621 @@
|
||||
/*
|
||||
* Wine Conformance Test EXE
|
||||
*
|
||||
* Copyright 2003, 2004 Jakob Eriksson (for Solid Form Sweden AB)
|
||||
* Copyright 2003 Dimitrie O. Paun
|
||||
* Copyright 2003 Ferenc Wagner
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* This program is dedicated to Anna Lindh,
|
||||
* Swedish Minister of Foreign Affairs.
|
||||
* Anna was murdered September 11, 2003.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
#include "winetest.h"
|
||||
#include "resource.h"
|
||||
|
||||
struct wine_test
|
||||
{
|
||||
char *name;
|
||||
int resource;
|
||||
int subtest_count;
|
||||
char **subtests;
|
||||
char *exename;
|
||||
};
|
||||
|
||||
struct rev_info
|
||||
{
|
||||
const char* file;
|
||||
const char* rev;
|
||||
};
|
||||
|
||||
static struct wine_test *wine_tests;
|
||||
static struct rev_info *rev_infos = NULL;
|
||||
static const char whitespace[] = " \t\r\n";
|
||||
|
||||
static int running_under_wine ()
|
||||
{
|
||||
HMODULE module = GetModuleHandleA("ntdll.dll");
|
||||
|
||||
if (!module) return 0;
|
||||
return (GetProcAddress(module, "wine_server_call") != NULL);
|
||||
}
|
||||
|
||||
static int running_on_visible_desktop ()
|
||||
{
|
||||
FARPROC pGetProcessWindowStation = GetProcAddress(GetModuleHandle("user32.dll"), "GetProcessWindowStation");
|
||||
|
||||
if (pGetProcessWindowStation)
|
||||
{
|
||||
DWORD len;
|
||||
HWINSTA wstation;
|
||||
USEROBJECTFLAGS uoflags;
|
||||
FARPROC pGetUserObjectInformationA = GetProcAddress(GetModuleHandle("user32.dll"), "GetUserObjectInformationA");
|
||||
|
||||
wstation = (HWINSTA)pGetProcessWindowStation();
|
||||
assert(pGetUserObjectInformationA(wstation, UOI_FLAGS, &uoflags, sizeof(uoflags), &len));
|
||||
return (uoflags.dwFlags & WSF_VISIBLE) != 0;
|
||||
}
|
||||
else
|
||||
return IsWindowVisible(GetDesktopWindow());
|
||||
}
|
||||
|
||||
void print_version ()
|
||||
{
|
||||
OSVERSIONINFOEX ver;
|
||||
BOOL ext;
|
||||
|
||||
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||
if (!(ext = GetVersionEx ((OSVERSIONINFO *) &ver)))
|
||||
{
|
||||
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
if (!GetVersionEx ((OSVERSIONINFO *) &ver))
|
||||
report (R_FATAL, "Can't get OS version.");
|
||||
}
|
||||
|
||||
xprintf (" bRunningUnderWine=%d\n", running_under_wine ());
|
||||
xprintf (" bRunningOnVisibleDesktop=%d\n", running_on_visible_desktop ());
|
||||
xprintf (" dwMajorVersion=%ld\n dwMinorVersion=%ld\n"
|
||||
" dwBuildNumber=%ld\n PlatformId=%ld\n szCSDVersion=%s\n",
|
||||
ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber,
|
||||
ver.dwPlatformId, ver.szCSDVersion);
|
||||
|
||||
if (!ext) return;
|
||||
|
||||
xprintf (" wServicePackMajor=%d\n wServicePackMinor=%d\n"
|
||||
" wSuiteMask=%d\n wProductType=%d\n wReserved=%d\n",
|
||||
ver.wServicePackMajor, ver.wServicePackMinor, ver.wSuiteMask,
|
||||
ver.wProductType, ver.wReserved);
|
||||
}
|
||||
|
||||
static inline int is_dot_dir(const char* x)
|
||||
{
|
||||
return ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0))));
|
||||
}
|
||||
|
||||
void remove_dir (const char *dir)
|
||||
{
|
||||
HANDLE hFind;
|
||||
WIN32_FIND_DATA wfd;
|
||||
char path[MAX_PATH];
|
||||
size_t dirlen = strlen (dir);
|
||||
|
||||
/* Make sure the directory exists before going further */
|
||||
memcpy (path, dir, dirlen);
|
||||
strcpy (path + dirlen++, "\\*");
|
||||
hFind = FindFirstFile (path, &wfd);
|
||||
if (hFind == INVALID_HANDLE_VALUE) return;
|
||||
|
||||
do {
|
||||
char *lp = wfd.cFileName;
|
||||
|
||||
if (!lp[0]) lp = wfd.cAlternateFileName; /* ? FIXME not (!lp) ? */
|
||||
if (is_dot_dir (lp)) continue;
|
||||
strcpy (path + dirlen, lp);
|
||||
if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)
|
||||
remove_dir(path);
|
||||
else if (!DeleteFile (path))
|
||||
report (R_WARNING, "Can't delete file %s: error %d",
|
||||
path, GetLastError ());
|
||||
} while (FindNextFile (hFind, &wfd));
|
||||
FindClose (hFind);
|
||||
if (!RemoveDirectory (dir))
|
||||
report (R_WARNING, "Can't remove directory %s: error %d",
|
||||
dir, GetLastError ());
|
||||
}
|
||||
|
||||
const char* get_test_source_file(const char* test, const char* subtest)
|
||||
{
|
||||
static const char* special_dirs[][2] = {
|
||||
{ "gdi32", "gdi"}, { "kernel32", "kernel" },
|
||||
{ "msacm32", "msacm" },
|
||||
{ "user32", "user" }, { "winspool.drv", "winspool" },
|
||||
{ "ws2_32", "winsock" }, { 0, 0 }
|
||||
};
|
||||
static char buffer[MAX_PATH];
|
||||
int i;
|
||||
|
||||
for (i = 0; special_dirs[i][0]; i++) {
|
||||
if (strcmp(test, special_dirs[i][0]) == 0) {
|
||||
test = special_dirs[i][1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "dlls/%s/tests/%s.c", test, subtest);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const char* get_file_rev(const char* file)
|
||||
{
|
||||
const struct rev_info* rev;
|
||||
|
||||
for(rev = rev_infos; rev->file; rev++) {
|
||||
if (strcmp(rev->file, file) == 0) return rev->rev;
|
||||
}
|
||||
|
||||
return "-";
|
||||
}
|
||||
|
||||
void extract_rev_infos ()
|
||||
{
|
||||
char revinfo[256], *p;
|
||||
int size = 0, i, len;
|
||||
HMODULE module = GetModuleHandle (NULL);
|
||||
|
||||
for (i = 0; TRUE; i++) {
|
||||
if (i >= size) {
|
||||
size += 100;
|
||||
rev_infos = xrealloc (rev_infos, size * sizeof (*rev_infos));
|
||||
}
|
||||
memset(rev_infos + i, 0, sizeof(rev_infos[i]));
|
||||
|
||||
len = LoadStringA (module, REV_INFO+i, revinfo, sizeof(revinfo));
|
||||
if (len == 0) break; /* end of revision info */
|
||||
if (len >= sizeof(revinfo) - 1)
|
||||
report (R_FATAL, "Revision info too long.");
|
||||
if(!(p = strrchr(revinfo, ':')))
|
||||
report (R_FATAL, "Revision info malformed (i=%d)", i);
|
||||
*p = 0;
|
||||
rev_infos[i].file = strdup(revinfo);
|
||||
rev_infos[i].rev = strdup(p + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void* extract_rcdata (int id, int type, DWORD* size)
|
||||
{
|
||||
HRSRC rsrc;
|
||||
HGLOBAL hdl;
|
||||
LPVOID addr;
|
||||
|
||||
if (!(rsrc = FindResource (NULL, (LPTSTR)id, MAKEINTRESOURCE(type))) ||
|
||||
!(*size = SizeofResource (0, rsrc)) ||
|
||||
!(hdl = LoadResource (0, rsrc)) ||
|
||||
!(addr = LockResource (hdl)))
|
||||
return NULL;
|
||||
return addr;
|
||||
}
|
||||
|
||||
/* Fills in the name and exename fields */
|
||||
void
|
||||
extract_test (struct wine_test *test, const char *dir, int id)
|
||||
{
|
||||
BYTE* code;
|
||||
DWORD size;
|
||||
FILE* fout;
|
||||
int strlen, bufflen = 128;
|
||||
char *exepos;
|
||||
|
||||
code = extract_rcdata (id, TESTRES, &size);
|
||||
if (!code) report (R_FATAL, "Can't find test resource %d: %d",
|
||||
id, GetLastError ());
|
||||
test->name = xmalloc (bufflen);
|
||||
while ((strlen = LoadStringA (NULL, id, test->name, bufflen))
|
||||
== bufflen - 1) {
|
||||
bufflen *= 2;
|
||||
test->name = xrealloc (test->name, bufflen);
|
||||
}
|
||||
if (!strlen) report (R_FATAL, "Can't read name of test %d.", id);
|
||||
test->exename = strmake (NULL, "%s/%s", dir, test->name);
|
||||
exepos = strstr (test->name, "_test.exe");
|
||||
if (!exepos) report (R_FATAL, "Not an .exe file: %s", test->name);
|
||||
*exepos = 0;
|
||||
test->name = xrealloc (test->name, exepos - test->name + 1);
|
||||
report (R_STEP, "Extracting: %s", test->name);
|
||||
|
||||
if (!(fout = fopen (test->exename, "wb")) ||
|
||||
(fwrite (code, size, 1, fout) != 1) ||
|
||||
fclose (fout)) report (R_FATAL, "Failed to write file %s.",
|
||||
test->exename);
|
||||
}
|
||||
|
||||
/* Run a command for MS milliseconds. If OUT != NULL, also redirect
|
||||
stdout to there.
|
||||
|
||||
Return the exit status, -2 if can't create process or the return
|
||||
value of WaitForSingleObject.
|
||||
*/
|
||||
int
|
||||
run_ex (char *cmd, const char *out, DWORD ms)
|
||||
{
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
int fd, oldstdout = -1;
|
||||
DWORD wait, status;
|
||||
|
||||
GetStartupInfo (&si);
|
||||
si.wShowWindow = SW_HIDE;
|
||||
si.dwFlags = STARTF_USESHOWWINDOW;
|
||||
|
||||
if (out) {
|
||||
fd = open (out, O_WRONLY | O_CREAT, 0666);
|
||||
if (-1 == fd)
|
||||
report (R_FATAL, "Can't open '%s': %d", out, errno);
|
||||
oldstdout = dup (1);
|
||||
if (-1 == oldstdout)
|
||||
report (R_FATAL, "Can't save stdout: %d", errno);
|
||||
if (-1 == dup2 (fd, 1))
|
||||
report (R_FATAL, "Can't redirect stdout: %d", errno);
|
||||
close (fd);
|
||||
}
|
||||
|
||||
if (!CreateProcessA (NULL, cmd, NULL, NULL, TRUE, 0,
|
||||
NULL, NULL, &si, &pi)) {
|
||||
status = -2;
|
||||
} else {
|
||||
CloseHandle (pi.hThread);
|
||||
wait = WaitForSingleObject (pi.hProcess, ms);
|
||||
if (wait == WAIT_OBJECT_0) {
|
||||
GetExitCodeProcess (pi.hProcess, &status);
|
||||
} else {
|
||||
switch (wait) {
|
||||
case WAIT_FAILED:
|
||||
report (R_ERROR, "Wait for '%s' failed: %d", cmd,
|
||||
GetLastError ());
|
||||
break;
|
||||
case WAIT_TIMEOUT:
|
||||
report (R_ERROR, "Process '%s' timed out.", cmd);
|
||||
break;
|
||||
default:
|
||||
report (R_ERROR, "Wait returned %d", wait);
|
||||
}
|
||||
status = wait;
|
||||
if (!TerminateProcess (pi.hProcess, 257))
|
||||
report (R_ERROR, "TerminateProcess failed: %d",
|
||||
GetLastError ());
|
||||
wait = WaitForSingleObject (pi.hProcess, 5000);
|
||||
switch (wait) {
|
||||
case WAIT_FAILED:
|
||||
report (R_ERROR,
|
||||
"Wait for termination of '%s' failed: %d",
|
||||
cmd, GetLastError ());
|
||||
break;
|
||||
case WAIT_OBJECT_0:
|
||||
break;
|
||||
case WAIT_TIMEOUT:
|
||||
report (R_ERROR, "Can't kill process '%s'", cmd);
|
||||
break;
|
||||
default:
|
||||
report (R_ERROR, "Waiting for termination: %d",
|
||||
wait);
|
||||
}
|
||||
}
|
||||
CloseHandle (pi.hProcess);
|
||||
}
|
||||
|
||||
if (out) {
|
||||
close (1);
|
||||
if (-1 == dup2 (oldstdout, 1))
|
||||
report (R_FATAL, "Can't recover stdout: %d", errno);
|
||||
close (oldstdout);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
get_subtests (const char *tempdir, struct wine_test *test, int id)
|
||||
{
|
||||
char *subname;
|
||||
FILE *subfile;
|
||||
size_t total;
|
||||
char buffer[8192], *index;
|
||||
static const char header[] = "Valid test names:";
|
||||
int allocated;
|
||||
|
||||
test->subtest_count = 0;
|
||||
|
||||
subname = tempnam (0, "sub");
|
||||
if (!subname) report (R_FATAL, "Can't name subtests file.");
|
||||
|
||||
extract_test (test, tempdir, id);
|
||||
run_ex (test->exename, subname, 5000);
|
||||
|
||||
subfile = fopen (subname, "r");
|
||||
if (!subfile) {
|
||||
report (R_ERROR, "Can't open subtests output of %s: %d",
|
||||
test->name, errno);
|
||||
goto quit;
|
||||
}
|
||||
total = fread (buffer, 1, sizeof buffer, subfile);
|
||||
fclose (subfile);
|
||||
if (sizeof buffer == total) {
|
||||
report (R_ERROR, "Subtest list of %s too big.",
|
||||
test->name, sizeof buffer);
|
||||
goto quit;
|
||||
}
|
||||
buffer[total] = 0;
|
||||
|
||||
index = strstr (buffer, header);
|
||||
if (!index) {
|
||||
report (R_ERROR, "Can't parse subtests output of %s",
|
||||
test->name);
|
||||
goto quit;
|
||||
}
|
||||
index += sizeof header;
|
||||
|
||||
allocated = 10;
|
||||
test->subtests = xmalloc (allocated * sizeof(char*));
|
||||
index = strtok (index, whitespace);
|
||||
while (index) {
|
||||
if (test->subtest_count == allocated) {
|
||||
allocated *= 2;
|
||||
test->subtests = xrealloc (test->subtests,
|
||||
allocated * sizeof(char*));
|
||||
}
|
||||
test->subtests[test->subtest_count++] = strdup (index);
|
||||
index = strtok (NULL, whitespace);
|
||||
}
|
||||
test->subtests = xrealloc (test->subtests,
|
||||
test->subtest_count * sizeof(char*));
|
||||
|
||||
quit:
|
||||
if (remove (subname))
|
||||
report (R_WARNING, "Can't delete file '%s': %d",
|
||||
subname, errno);
|
||||
free (subname);
|
||||
}
|
||||
|
||||
void
|
||||
run_test (struct wine_test* test, const char* subtest)
|
||||
{
|
||||
int status;
|
||||
const char* file = get_test_source_file(test->name, subtest);
|
||||
const char* rev = get_file_rev(file);
|
||||
char *cmd = strmake (NULL, "%s %s", test->exename, subtest);
|
||||
|
||||
xprintf ("%s:%s start %s %s\n", test->name, subtest, file, rev);
|
||||
status = run_ex (cmd, NULL, 120000);
|
||||
free (cmd);
|
||||
xprintf ("%s:%s done (%d)\n", test->name, subtest, status);
|
||||
}
|
||||
|
||||
BOOL CALLBACK
|
||||
EnumTestFileProc (HMODULE hModule, LPCTSTR lpszType,
|
||||
LPTSTR lpszName, LONG_PTR lParam)
|
||||
{
|
||||
(*(int*)lParam)++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char *
|
||||
run_tests (char *logname, const char *tag)
|
||||
{
|
||||
int nr_of_files = 0, nr_of_tests = 0, i;
|
||||
char *tempdir;
|
||||
int logfile;
|
||||
char *strres, *eol, *nextline;
|
||||
DWORD strsize;
|
||||
|
||||
SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
||||
|
||||
if (!logname) {
|
||||
logname = tempnam (0, "res");
|
||||
if (!logname) report (R_FATAL, "Can't name logfile.");
|
||||
}
|
||||
report (R_OUT, logname);
|
||||
|
||||
logfile = open (logname, O_WRONLY | O_CREAT | O_EXCL | O_APPEND,
|
||||
0666);
|
||||
if (-1 == logfile) {
|
||||
if (EEXIST == errno)
|
||||
report (R_FATAL, "File %s already exists.", logname);
|
||||
else report (R_FATAL, "Could not open logfile: %d", errno);
|
||||
}
|
||||
if (-1 == dup2 (logfile, 1))
|
||||
report (R_FATAL, "Can't redirect stdout: %d", errno);
|
||||
close (logfile);
|
||||
|
||||
tempdir = tempnam (0, "wct");
|
||||
if (!tempdir)
|
||||
report (R_FATAL, "Can't name temporary dir (check %%TEMP%%).");
|
||||
report (R_DIR, tempdir);
|
||||
if (!CreateDirectory (tempdir, NULL))
|
||||
report (R_FATAL, "Could not create directory: %s", tempdir);
|
||||
|
||||
xprintf ("Version 3\n");
|
||||
strres = extract_rcdata (WINE_BUILD, STRINGRES, &strsize);
|
||||
xprintf ("Tests from build ");
|
||||
if (strres) xprintf ("%.*s", strsize, strres);
|
||||
else xprintf ("-\n");
|
||||
strres = extract_rcdata (TESTS_URL, STRINGRES, &strsize);
|
||||
xprintf ("Archive: ");
|
||||
if (strres) xprintf ("%.*s", strsize, strres);
|
||||
else xprintf ("-\n");
|
||||
xprintf ("Tag: %s\n", tag?tag:"");
|
||||
xprintf ("Build info:\n");
|
||||
strres = extract_rcdata (BUILD_INFO, STRINGRES, &strsize);
|
||||
while (strres) {
|
||||
eol = memchr (strres, '\n', strsize);
|
||||
if (!eol) {
|
||||
nextline = NULL;
|
||||
eol = strres + strsize;
|
||||
} else {
|
||||
strsize -= eol - strres + 1;
|
||||
nextline = strsize?eol+1:NULL;
|
||||
if (eol > strres && *(eol-1) == '\r') eol--;
|
||||
}
|
||||
xprintf (" %.*s\n", eol-strres, strres);
|
||||
strres = nextline;
|
||||
}
|
||||
xprintf ("Operating system version:\n");
|
||||
print_version ();
|
||||
xprintf ("Test output:\n" );
|
||||
|
||||
report (R_STATUS, "Counting tests");
|
||||
if (!EnumResourceNames (NULL, MAKEINTRESOURCE(TESTRES),
|
||||
EnumTestFileProc, (LPARAM)&nr_of_files))
|
||||
report (R_FATAL, "Can't enumerate test files: %d",
|
||||
GetLastError ());
|
||||
wine_tests = xmalloc (nr_of_files * sizeof wine_tests[0]);
|
||||
|
||||
report (R_STATUS, "Extracting tests");
|
||||
report (R_PROGRESS, 0, nr_of_files);
|
||||
for (i = 0; i < nr_of_files; i++) {
|
||||
get_subtests (tempdir, wine_tests+i, i);
|
||||
nr_of_tests += wine_tests[i].subtest_count;
|
||||
}
|
||||
report (R_DELTA, 0, "Extracting: Done");
|
||||
|
||||
report (R_STATUS, "Running tests");
|
||||
report (R_PROGRESS, 1, nr_of_tests);
|
||||
for (i = 0; i < nr_of_files; i++) {
|
||||
struct wine_test *test = wine_tests + i;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < test->subtest_count; j++) {
|
||||
report (R_STEP, "Running: %s:%s", test->name,
|
||||
test->subtests[j]);
|
||||
run_test (test, test->subtests[j]);
|
||||
}
|
||||
}
|
||||
report (R_DELTA, 0, "Running: Done");
|
||||
|
||||
report (R_STATUS, "Cleaning up");
|
||||
close (1);
|
||||
remove_dir (tempdir);
|
||||
free (tempdir);
|
||||
free (wine_tests);
|
||||
|
||||
return logname;
|
||||
}
|
||||
|
||||
void
|
||||
usage ()
|
||||
{
|
||||
fprintf (stderr, "\
|
||||
Usage: winetest [OPTION]...\n\n\
|
||||
-c console mode, no GUI\n\
|
||||
-e preserve the environment\n\
|
||||
-h print this message and exit\n\
|
||||
-q quiet mode, no output at all\n\
|
||||
-o FILE put report into FILE, do not submit\n\
|
||||
-s FILE submit FILE, do not run tests\n\
|
||||
-t TAG include TAG of characters [-.0-9a-zA-Z] in the report\n");
|
||||
}
|
||||
|
||||
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
|
||||
LPSTR cmdLine, int cmdShow)
|
||||
{
|
||||
char *logname = NULL;
|
||||
const char *cp, *submit = NULL, *tag = NULL;
|
||||
int reset_env = 1;
|
||||
|
||||
if (!running_on_visible_desktop ()) {
|
||||
report (R_ERROR, "Tests must be run on a visible desktop");
|
||||
exit (2);
|
||||
}
|
||||
|
||||
/* initialize the revision information first */
|
||||
extract_rev_infos();
|
||||
|
||||
cmdLine = strtok (cmdLine, whitespace);
|
||||
while (cmdLine) {
|
||||
if (cmdLine[0] != '-' || cmdLine[2]) {
|
||||
report (R_ERROR, "Not a single letter option: %s", cmdLine);
|
||||
usage ();
|
||||
exit (2);
|
||||
}
|
||||
switch (cmdLine[1]) {
|
||||
case 'c':
|
||||
report (R_TEXTMODE);
|
||||
break;
|
||||
case 'e':
|
||||
reset_env = 0;
|
||||
break;
|
||||
case 'h':
|
||||
usage ();
|
||||
exit (0);
|
||||
case 'q':
|
||||
report (R_QUIET);
|
||||
break;
|
||||
case 's':
|
||||
submit = strtok (NULL, whitespace);
|
||||
if (tag)
|
||||
report (R_WARNING, "ignoring tag for submission");
|
||||
send_file (submit);
|
||||
break;
|
||||
case 'o':
|
||||
logname = strtok (NULL, whitespace);
|
||||
break;
|
||||
case 't':
|
||||
tag = strtok (NULL, whitespace);
|
||||
cp = badtagchar (tag);
|
||||
if (cp) {
|
||||
report (R_ERROR, "invalid char in tag: %c", *cp);
|
||||
usage ();
|
||||
exit (2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
report (R_ERROR, "invalid option: -%c", cmdLine[1]);
|
||||
usage ();
|
||||
exit (2);
|
||||
}
|
||||
cmdLine = strtok (NULL, whitespace);
|
||||
}
|
||||
if (!submit) {
|
||||
if (reset_env && (putenv ("WINETEST_PLATFORM=windows") ||
|
||||
putenv ("WINETEST_DEBUG=1") ||
|
||||
putenv ("WINETEST_INTERACTIVE=0") ||
|
||||
putenv ("WINETEST_REPORT_SUCCESS=0")))
|
||||
report (R_FATAL, "Could not reset environment: %d", errno);
|
||||
|
||||
report (R_STATUS, "Starting up");
|
||||
if (!logname) {
|
||||
logname = run_tests (NULL, tag);
|
||||
if (report (R_ASK, MB_YESNO, "Do you want to submit the "
|
||||
"test results?") == IDYES)
|
||||
if (!send_file (logname) && remove (logname))
|
||||
report (R_WARNING, "Can't remove logfile: %d.", errno);
|
||||
free (logname);
|
||||
} else run_tests (logname, tag);
|
||||
report (R_STATUS, "Finished");
|
||||
}
|
||||
exit (0);
|
||||
}
|
23
reactos/apps/utils/winetest/makefile
Normal file
23
reactos/apps/utils/winetest/makefile
Normal file
@@ -0,0 +1,23 @@
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = winetest
|
||||
|
||||
TARGET_SDKLIBS = comctl32.a comdlg32.a ws2_32.a
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
main.o \
|
||||
send.o \
|
||||
util.o \
|
||||
gui.o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
469
reactos/apps/utils/winetest/port.h
Normal file
469
reactos/apps/utils/winetest/port.h
Normal file
@@ -0,0 +1,469 @@
|
||||
/*
|
||||
* Wine porting definitions
|
||||
*
|
||||
* Copyright 1996 Alexandre Julliard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_WINE_PORT_H
|
||||
#define __WINE_WINE_PORT_H
|
||||
|
||||
#ifndef __WINE_CONFIG_H
|
||||
# error You must include config.h to use this header
|
||||
#endif
|
||||
|
||||
#define _GNU_SOURCE /* for pread/pwrite */
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_DIRECT_H
|
||||
# include <direct.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_PROCESS_H
|
||||
# include <process.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* Type definitions
|
||||
*/
|
||||
|
||||
#ifndef HAVE_MODE_T
|
||||
typedef int mode_t;
|
||||
#endif
|
||||
#ifndef HAVE_OFF_T
|
||||
typedef long off_t;
|
||||
#endif
|
||||
#ifndef HAVE_PID_T
|
||||
typedef int pid_t;
|
||||
#endif
|
||||
#ifndef HAVE_SIZE_T
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
#ifndef HAVE_SSIZE_T
|
||||
typedef int ssize_t;
|
||||
#endif
|
||||
#ifndef HAVE_FSBLKCNT_T
|
||||
typedef unsigned long fsblkcnt_t;
|
||||
#endif
|
||||
#ifndef HAVE_FSFILCNT_T
|
||||
typedef unsigned long fsfilcnt_t;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRUCT_STATVFS_F_BLOCKS
|
||||
struct statvfs
|
||||
{
|
||||
unsigned long f_bsize;
|
||||
unsigned long f_frsize;
|
||||
fsblkcnt_t f_blocks;
|
||||
fsblkcnt_t f_bfree;
|
||||
fsblkcnt_t f_bavail;
|
||||
fsfilcnt_t f_files;
|
||||
fsfilcnt_t f_ffree;
|
||||
fsfilcnt_t f_favail;
|
||||
unsigned long f_fsid;
|
||||
unsigned long f_flag;
|
||||
unsigned long f_namemax;
|
||||
};
|
||||
#endif /* HAVE_STRUCT_STATVFS_F_BLOCKS */
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* Macro definitions
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#else
|
||||
#define RTLD_LAZY 0x001
|
||||
#define RTLD_NOW 0x002
|
||||
#define RTLD_GLOBAL 0x100
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_FTRUNCATE) && defined(HAVE_CHSIZE)
|
||||
#define ftruncate chsize
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_POPEN) && defined(HAVE__POPEN)
|
||||
#define popen _popen
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_PCLOSE) && defined(HAVE__PCLOSE)
|
||||
#define pclose _pclose
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_VSNPRINTF) && defined(HAVE__VSNPRINTF)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
#ifndef S_ISLNK
|
||||
# define S_ISLNK(mod) (0)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISSOCK
|
||||
# define S_ISSOCK(mod) (0)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISDIR
|
||||
# define S_ISDIR(mod) (((mod) & _S_IFMT) == _S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISCHR
|
||||
# define S_ISCHR(mod) (((mod) & _S_IFMT) == _S_IFCHR)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISFIFO
|
||||
# define S_ISFIFO(mod) (((mod) & _S_IFMT) == _S_IFIFO)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISREG
|
||||
# define S_ISREG(mod) (((mod) & _S_IFMT) == _S_IFREG)
|
||||
#endif
|
||||
|
||||
#ifndef S_IWUSR
|
||||
# define S_IWUSR 0
|
||||
#endif
|
||||
|
||||
/* So we open files in 64 bit access mode on Linux */
|
||||
#ifndef O_LARGEFILE
|
||||
# define O_LARGEFILE 0
|
||||
#endif
|
||||
|
||||
#ifndef O_NONBLOCK
|
||||
# define O_NONBLOCK 0
|
||||
#endif
|
||||
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif
|
||||
|
||||
#if !defined(S_IXUSR) && defined(S_IEXEC)
|
||||
# define S_IXUSR S_IEXEC
|
||||
#endif
|
||||
#if !defined(S_IXGRP) && defined(S_IEXEC)
|
||||
# define S_IXGRP S_IEXEC
|
||||
#endif
|
||||
#if !defined(S_IXOTH) && defined(S_IEXEC)
|
||||
# define S_IXOTH S_IEXEC
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* Constants
|
||||
*/
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#ifndef M_PI_2
|
||||
#define M_PI_2 1.570796326794896619
|
||||
#endif
|
||||
|
||||
|
||||
/* Macros to define assembler functions somewhat portably */
|
||||
|
||||
#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__APPLE__)
|
||||
# define __ASM_GLOBAL_FUNC(name,code) \
|
||||
__asm__( ".text\n\t" \
|
||||
".align 4\n\t" \
|
||||
".globl " __ASM_NAME(#name) "\n\t" \
|
||||
__ASM_FUNC(#name) "\n" \
|
||||
__ASM_NAME(#name) ":\n\t" \
|
||||
code \
|
||||
"\n\t.previous" );
|
||||
#else /* defined(__GNUC__) && !defined(__MINGW32__) && !defined(__APPLE__) */
|
||||
# define __ASM_GLOBAL_FUNC(name,code) \
|
||||
void __asm_dummy_##name(void) { \
|
||||
asm( ".align 4\n\t" \
|
||||
".globl " __ASM_NAME(#name) "\n\t" \
|
||||
__ASM_FUNC(#name) "\n" \
|
||||
__ASM_NAME(#name) ":\n\t" \
|
||||
code ); \
|
||||
}
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
|
||||
/* Constructor functions */
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define DECL_GLOBAL_CONSTRUCTOR(func) \
|
||||
static void func(void) __attribute__((constructor)); \
|
||||
static void func(void)
|
||||
#elif defined(__i386__)
|
||||
# define DECL_GLOBAL_CONSTRUCTOR(func) \
|
||||
static void __dummy_init_##func(void) { \
|
||||
asm(".section .init,\"ax\"\n\t" \
|
||||
"call " #func "\n\t" \
|
||||
".previous"); } \
|
||||
static void func(void)
|
||||
#elif defined(__sparc__)
|
||||
# define DECL_GLOBAL_CONSTRUCTOR(func) \
|
||||
static void __dummy_init_##func(void) { \
|
||||
asm("\t.section \".init\",#alloc,#execinstr\n" \
|
||||
"\tcall " #func "\n" \
|
||||
"\tnop\n" \
|
||||
"\t.section \".text\",#alloc,#execinstr\n" ); } \
|
||||
static void func(void)
|
||||
#else
|
||||
# error You must define the DECL_GLOBAL_CONSTRUCTOR macro for your platform
|
||||
#endif
|
||||
|
||||
|
||||
/* Register functions */
|
||||
|
||||
#ifdef __i386__
|
||||
#define DEFINE_REGS_ENTRYPOINT( name, fn, args, pop_args ) \
|
||||
__ASM_GLOBAL_FUNC( name, \
|
||||
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
|
||||
".long " __ASM_NAME(#fn) "\n\t" \
|
||||
".byte " #args "," #pop_args )
|
||||
/* FIXME: add support for other CPUs */
|
||||
#endif /* __i386__ */
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* Function definitions (only when using libwine_port)
|
||||
*/
|
||||
|
||||
#ifndef NO_LIBWINE_PORT
|
||||
|
||||
#ifndef HAVE_FSTATVFS
|
||||
int fstatvfs( int fd, struct statvfs *buf );
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern int opterr;
|
||||
extern int optopt;
|
||||
struct option;
|
||||
|
||||
#ifndef HAVE_STRUCT_OPTION_NAME
|
||||
struct option
|
||||
{
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
#endif
|
||||
|
||||
extern int getopt_long (int ___argc, char *const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind);
|
||||
extern int getopt_long_only (int ___argc, char *const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind);
|
||||
#endif /* HAVE_GETOPT_LONG */
|
||||
|
||||
#ifndef HAVE_FFS
|
||||
int ffs( int x );
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FUTIMES
|
||||
struct timeval;
|
||||
int futimes(int fd, const struct timeval tv[2]);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETPAGESIZE
|
||||
size_t getpagesize(void);
|
||||
#endif /* HAVE_GETPAGESIZE */
|
||||
|
||||
#ifndef HAVE_GETTID
|
||||
pid_t gettid(void);
|
||||
#endif /* HAVE_GETTID */
|
||||
|
||||
#ifndef HAVE_LSTAT
|
||||
int lstat(const char *file_name, struct stat *buf);
|
||||
#endif /* HAVE_LSTAT */
|
||||
|
||||
#ifndef HAVE_MEMMOVE
|
||||
void *memmove(void *dest, const void *src, size_t len);
|
||||
#endif /* !defined(HAVE_MEMMOVE) */
|
||||
|
||||
#ifndef HAVE_PREAD
|
||||
ssize_t pread( int fd, void *buf, size_t count, off_t offset );
|
||||
#endif /* HAVE_PREAD */
|
||||
|
||||
#ifndef HAVE_PWRITE
|
||||
ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset );
|
||||
#endif /* HAVE_PWRITE */
|
||||
|
||||
#ifndef HAVE_READLINK
|
||||
int readlink( const char *path, char *buf, size_t size );
|
||||
#endif /* HAVE_READLINK */
|
||||
|
||||
#ifndef HAVE_SIGSETJMP
|
||||
# include <setjmp.h>
|
||||
typedef jmp_buf sigjmp_buf;
|
||||
int sigsetjmp( sigjmp_buf buf, int savesigs );
|
||||
void siglongjmp( sigjmp_buf buf, int val );
|
||||
#endif /* HAVE_SIGSETJMP */
|
||||
|
||||
#ifndef HAVE_STATVFS
|
||||
int statvfs( const char *path, struct statvfs *buf );
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
# ifndef HAVE__STRNICMP
|
||||
int strncasecmp(const char *str1, const char *str2, size_t n);
|
||||
# else
|
||||
# define strncasecmp _strnicmp
|
||||
# endif
|
||||
#endif /* !defined(HAVE_STRNCASECMP) */
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
const char *strerror(int err);
|
||||
#endif /* !defined(HAVE_STRERROR) */
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
# ifndef HAVE__STRICMP
|
||||
int strcasecmp(const char *str1, const char *str2);
|
||||
# else
|
||||
# define strcasecmp _stricmp
|
||||
# endif
|
||||
#endif /* !defined(HAVE_STRCASECMP) */
|
||||
|
||||
#ifndef HAVE_USLEEP
|
||||
int usleep (unsigned int useconds);
|
||||
#endif /* !defined(HAVE_USLEEP) */
|
||||
|
||||
#ifdef __i386__
|
||||
static inline void *memcpy_unaligned( void *dst, const void *src, size_t size )
|
||||
{
|
||||
return memcpy( dst, src, size );
|
||||
}
|
||||
#else
|
||||
extern void *memcpy_unaligned( void *dst, const void *src, size_t size );
|
||||
#endif /* __i386__ */
|
||||
|
||||
extern int mkstemps(char *template, int suffix_len);
|
||||
|
||||
/* Process creation flags */
|
||||
#ifndef _P_WAIT
|
||||
# define _P_WAIT 0
|
||||
# define _P_NOWAIT 1
|
||||
# define _P_OVERLAY 2
|
||||
# define _P_NOWAITO 3
|
||||
# define _P_DETACH 4
|
||||
#endif
|
||||
#ifndef HAVE_SPAWNVP
|
||||
extern int spawnvp(int mode, const char *cmdname, const char * const argv[]);
|
||||
#endif
|
||||
|
||||
/* Interlocked functions */
|
||||
|
||||
#if defined(__i386__) && defined(__GNUC__)
|
||||
|
||||
extern inline long interlocked_cmpxchg( long *dest, long xchg, long compare );
|
||||
extern inline void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare );
|
||||
extern inline long interlocked_xchg( long *dest, long val );
|
||||
extern inline void *interlocked_xchg_ptr( void **dest, void *val );
|
||||
extern inline long interlocked_xchg_add( long *dest, long incr );
|
||||
|
||||
extern inline long interlocked_cmpxchg( long *dest, long xchg, long compare )
|
||||
{
|
||||
long ret;
|
||||
__asm__ __volatile__( "lock; cmpxchgl %2,(%1)"
|
||||
: "=a" (ret) : "r" (dest), "r" (xchg), "0" (compare) : "memory" );
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern inline void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare )
|
||||
{
|
||||
void *ret;
|
||||
__asm__ __volatile__( "lock; cmpxchgl %2,(%1)"
|
||||
: "=a" (ret) : "r" (dest), "r" (xchg), "0" (compare) : "memory" );
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern inline long interlocked_xchg( long *dest, long val )
|
||||
{
|
||||
long ret;
|
||||
__asm__ __volatile__( "lock; xchgl %0,(%1)"
|
||||
: "=r" (ret) : "r" (dest), "0" (val) : "memory" );
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern inline void *interlocked_xchg_ptr( void **dest, void *val )
|
||||
{
|
||||
void *ret;
|
||||
__asm__ __volatile__( "lock; xchgl %0,(%1)"
|
||||
: "=r" (ret) : "r" (dest), "0" (val) : "memory" );
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern inline long interlocked_xchg_add( long *dest, long incr )
|
||||
{
|
||||
long ret;
|
||||
__asm__ __volatile__( "lock; xaddl %0,(%1)"
|
||||
: "=r" (ret) : "r" (dest), "0" (incr) : "memory" );
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else /* __i386___ && __GNUC__ */
|
||||
|
||||
extern long interlocked_cmpxchg( long *dest, long xchg, long compare );
|
||||
extern void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare );
|
||||
extern long interlocked_xchg( long *dest, long val );
|
||||
extern void *interlocked_xchg_ptr( void **dest, void *val );
|
||||
extern long interlocked_xchg_add( long *dest, long incr );
|
||||
|
||||
#endif /* __i386___ && __GNUC__ */
|
||||
|
||||
#else /* NO_LIBWINE_PORT */
|
||||
|
||||
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
|
||||
|
||||
#define ffs __WINE_NOT_PORTABLE(ffs)
|
||||
#define fstatvfs __WINE_NOT_PORTABLE(fstatvfs)
|
||||
#define futimes __WINE_NOT_PORTABLE(futimes)
|
||||
#define getopt_long __WINE_NOT_PORTABLE(getopt_long)
|
||||
#define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only)
|
||||
#define getpagesize __WINE_NOT_PORTABLE(getpagesize)
|
||||
#define interlocked_cmpxchg __WINE_NOT_PORTABLE(interlocked_cmpxchg)
|
||||
#define interlocked_cmpxchg_ptr __WINE_NOT_PORTABLE(interlocked_cmpxchg_ptr)
|
||||
#define interlocked_xchg __WINE_NOT_PORTABLE(interlocked_xchg)
|
||||
#define interlocked_xchg_ptr __WINE_NOT_PORTABLE(interlocked_xchg_ptr)
|
||||
#define interlocked_xchg_add __WINE_NOT_PORTABLE(interlocked_xchg_add)
|
||||
#define lstat __WINE_NOT_PORTABLE(lstat)
|
||||
#define memcpy_unaligned __WINE_NOT_PORTABLE(memcpy_unaligned)
|
||||
#define memmove __WINE_NOT_PORTABLE(memmove)
|
||||
#define pread __WINE_NOT_PORTABLE(pread)
|
||||
#define pwrite __WINE_NOT_PORTABLE(pwrite)
|
||||
#define spawnvp __WINE_NOT_PORTABLE(spawnvp)
|
||||
#define statvfs __WINE_NOT_PORTABLE(statvfs)
|
||||
#define strcasecmp __WINE_NOT_PORTABLE(strcasecmp)
|
||||
#define strerror __WINE_NOT_PORTABLE(strerror)
|
||||
#define strncasecmp __WINE_NOT_PORTABLE(strncasecmp)
|
||||
#define usleep __WINE_NOT_PORTABLE(usleep)
|
||||
|
||||
#endif /* NO_LIBWINE_PORT */
|
||||
|
||||
#endif /* !defined(__WINE_WINE_PORT_H) */
|
53
reactos/apps/utils/winetest/resource.h
Normal file
53
reactos/apps/utils/winetest/resource.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Resource definitions
|
||||
*
|
||||
* Copyright 2004 Ferenc Wagner
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define IDI_WINE 1
|
||||
|
||||
#define IDD_STATUS 100
|
||||
#define IDD_ABOUT 101
|
||||
|
||||
#define IDC_ST0 1000
|
||||
#define IDC_PB0 1001
|
||||
#define IDC_ST1 1002
|
||||
#define IDC_PB1 1003
|
||||
#define IDC_ST2 1004
|
||||
#define IDC_PB2 1005
|
||||
|
||||
#define IDC_DIR 2000
|
||||
#define IDC_OUT 2001
|
||||
|
||||
#define IDC_SB 3000
|
||||
|
||||
#define IDC_EDIT 4000
|
||||
#define IDC_ABOUT 4001
|
||||
|
||||
/* Resource types */
|
||||
|
||||
#define TESTRES 1000
|
||||
#define STRINGRES 1001
|
||||
|
||||
/* String resources */
|
||||
|
||||
#define WINE_BUILD 10000
|
||||
#define BUILD_INFO 10001
|
||||
#define TESTS_URL 10002
|
||||
|
||||
/* Revision info strings start from this index: */
|
||||
#define REV_INFO 30000
|
223
reactos/apps/utils/winetest/send.c
Normal file
223
reactos/apps/utils/winetest/send.c
Normal file
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* HTTP handling functions.
|
||||
*
|
||||
* Copyright 2003 Ferenc Wagner
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <winsock.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "winetest.h"
|
||||
|
||||
SOCKET
|
||||
open_http (const char *server)
|
||||
{
|
||||
WSADATA wsad;
|
||||
struct sockaddr_in sa;
|
||||
SOCKET s;
|
||||
|
||||
report (R_STATUS, "Opening HTTP connection to %s", server);
|
||||
if (WSAStartup (MAKEWORD (2,2), &wsad)) return INVALID_SOCKET;
|
||||
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons (80);
|
||||
sa.sin_addr.s_addr = inet_addr (server);
|
||||
if (sa.sin_addr.s_addr == INADDR_NONE) {
|
||||
struct hostent *host = gethostbyname (server);
|
||||
if (!host) {
|
||||
report (R_ERROR, "Hostname lookup failed for %s", server);
|
||||
goto failure;
|
||||
}
|
||||
sa.sin_addr.s_addr = ((struct in_addr *)host->h_addr)->s_addr;
|
||||
}
|
||||
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (s == INVALID_SOCKET) {
|
||||
report (R_ERROR, "Can't open network socket: %d",
|
||||
WSAGetLastError ());
|
||||
goto failure;
|
||||
}
|
||||
if (!connect (s, (struct sockaddr*)&sa, sizeof (struct sockaddr_in)))
|
||||
return s;
|
||||
|
||||
report (R_ERROR, "Can't connect: %d", WSAGetLastError ());
|
||||
closesocket (s);
|
||||
failure:
|
||||
WSACleanup ();
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
int
|
||||
close_http (SOCKET s)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = closesocket (s);
|
||||
return (WSACleanup () || ret);
|
||||
}
|
||||
|
||||
int
|
||||
send_buf (SOCKET s, const char *buf, size_t length)
|
||||
{
|
||||
int sent;
|
||||
|
||||
while (length > 0) {
|
||||
sent = send (s, buf, length, 0);
|
||||
if (sent == SOCKET_ERROR) return 1;
|
||||
buf += sent;
|
||||
length -= sent;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
send_str (SOCKET s, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *p;
|
||||
int ret;
|
||||
size_t len;
|
||||
|
||||
va_start (ap, s);
|
||||
p = vstrmake (&len, ap);
|
||||
va_end (ap);
|
||||
if (!p) return 1;
|
||||
ret = send_buf (s, p, len);
|
||||
free (p);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
send_file (const char *name)
|
||||
{
|
||||
SOCKET s;
|
||||
FILE *f;
|
||||
#define BUFLEN 8192
|
||||
unsigned char buffer[BUFLEN+1];
|
||||
size_t bytes_read, total, filesize;
|
||||
char *str;
|
||||
int ret;
|
||||
|
||||
/* RFC 2616 */
|
||||
#define SEP "--8<--cut-here--8<--"
|
||||
static const char head[] = "POST /submit HTTP/1.0\r\n"
|
||||
"Host: test.winehq.org\r\n"
|
||||
"User-Agent: Winetest Shell\r\n"
|
||||
"Content-Type: multipart/form-data; boundary=\"" SEP "\"\r\n"
|
||||
"Content-Length: %u\r\n\r\n";
|
||||
static const char body1[] = "--" SEP "\r\n"
|
||||
"Content-Disposition: form-data; name=\"reportfile\"; filename=\"%s\"\r\n"
|
||||
"Content-Type: application/octet-stream\r\n\r\n";
|
||||
static const char body2[] = "\r\n--" SEP "\r\n"
|
||||
"Content-Disposition: form-data; name=\"submit\"\r\n\r\n"
|
||||
"Upload File\r\n"
|
||||
"--" SEP "--\r\n";
|
||||
|
||||
s = open_http ("test.winehq.org");
|
||||
if (s == INVALID_SOCKET) return 1;
|
||||
|
||||
f = fopen (name, "rb");
|
||||
if (!f) {
|
||||
report (R_WARNING, "Can't open file '%s': %d", name, errno);
|
||||
goto abort1;
|
||||
}
|
||||
fseek (f, 0, SEEK_END);
|
||||
filesize = ftell (f);
|
||||
if (filesize > 1024*1024) {
|
||||
report (R_WARNING,
|
||||
"File too big (%.1f MB > 1 MB); submitting partial report.",
|
||||
filesize/1024.0/1024);
|
||||
filesize = 1024*1024;
|
||||
}
|
||||
fseek (f, 0, SEEK_SET);
|
||||
|
||||
report (R_STATUS, "Sending header");
|
||||
str = strmake (&total, body1, name);
|
||||
ret = send_str (s, head, filesize + total + sizeof body2 - 1) ||
|
||||
send_buf (s, str, total);
|
||||
free (str);
|
||||
if (ret) {
|
||||
report (R_WARNING, "Error sending header: %d, %d",
|
||||
errno, WSAGetLastError ());
|
||||
goto abort2;
|
||||
}
|
||||
|
||||
report (R_STATUS, "Sending %u bytes of data", filesize);
|
||||
report (R_PROGRESS, 2, filesize);
|
||||
total = 0;
|
||||
while (total < filesize && (bytes_read = fread (buffer, 1, BUFLEN/2, f))) {
|
||||
if ((signed)bytes_read == -1) {
|
||||
report (R_WARNING, "Error reading log file: %d", errno);
|
||||
goto abort2;
|
||||
}
|
||||
total += bytes_read;
|
||||
if (total > filesize) bytes_read -= total - filesize;
|
||||
if (send_buf (s, buffer, bytes_read)) {
|
||||
report (R_WARNING, "Error sending body: %d, %d",
|
||||
errno, WSAGetLastError ());
|
||||
goto abort2;
|
||||
}
|
||||
report (R_DELTA, bytes_read, "Network transfer: In progress");
|
||||
}
|
||||
fclose (f);
|
||||
|
||||
if (send_buf (s, body2, sizeof body2 - 1)) {
|
||||
report (R_WARNING, "Error sending trailer: %d, %d",
|
||||
errno, WSAGetLastError ());
|
||||
goto abort2;
|
||||
}
|
||||
report (R_DELTA, 0, "Network transfer: Done");
|
||||
|
||||
total = 0;
|
||||
while ((bytes_read = recv (s, buffer+total, BUFLEN-total, 0))) {
|
||||
if ((signed)bytes_read == SOCKET_ERROR) {
|
||||
report (R_WARNING, "Error receiving reply: %d, %d",
|
||||
errno, WSAGetLastError ());
|
||||
goto abort1;
|
||||
}
|
||||
total += bytes_read;
|
||||
if (total == BUFLEN) {
|
||||
report (R_WARNING, "Buffer overflow");
|
||||
goto abort1;
|
||||
}
|
||||
}
|
||||
if (close_http (s)) {
|
||||
report (R_WARNING, "Error closing connection: %d, %d",
|
||||
errno, WSAGetLastError ());
|
||||
return 1;
|
||||
}
|
||||
|
||||
str = strmake (&bytes_read, "Received %s (%d bytes).\n",
|
||||
name, filesize);
|
||||
ret = memcmp (str, buffer + total - bytes_read, bytes_read);
|
||||
free (str);
|
||||
if (ret) {
|
||||
buffer[total] = 0;
|
||||
str = strstr (buffer, "\r\n\r\n");
|
||||
if (!str) str = buffer;
|
||||
else str = str + 4;
|
||||
report (R_ERROR, "Can't submit logfile '%s'. "
|
||||
"Server response: %s", name, str);
|
||||
}
|
||||
return ret;
|
||||
|
||||
abort2:
|
||||
fclose (f);
|
||||
abort1:
|
||||
close_http (s);
|
||||
return 1;
|
||||
}
|
20
reactos/apps/utils/winetest/tests.rc
Normal file
20
reactos/apps/utils/winetest/tests.rc
Normal file
@@ -0,0 +1,20 @@
|
||||
/* Automatically generated -- do not edit! */
|
||||
#include "resource.h"
|
||||
STRINGTABLE {
|
||||
0 "advapi32_test.exe"
|
||||
1 "comctl32_test.exe"
|
||||
REV_INFO+0 "lib/advapi32/winetests/crypt_lmhash.c:1.1"
|
||||
REV_INFO+1 "lib/advapi32/winetests/crypt_md4.c:1.1"
|
||||
REV_INFO+2 "lib/advapi32/winetests/crypt_md5.c:1.1"
|
||||
REV_INFO+3 "lib/advapi32/winetests/crypt_sha.c:1.1"
|
||||
REV_INFO+4 "lib/advapi32/winetests/registry.c:1.1"
|
||||
REV_INFO+5 "lib/advapi32/winetests/security.c:1."
|
||||
REV_INFO+6 "lib/advapi32/winetests/crypt.c:1.1"
|
||||
REV_INFO+7 "dlls/comctl32/tests/imagelist.c:1.1"
|
||||
REV_INFO+8 "dlls/comctl32/tests/mru.c:1.1"
|
||||
REV_INFO+9 "dlls/comctl32/tests/subclass.c:1.1"
|
||||
REV_INFO+10 "dlls/comctl32/tests/tab.c:1.1"
|
||||
|
||||
}
|
||||
0 TESTRES "../../../lib/advapi32/winetests/advapi32_test.exe"
|
||||
1 TESTRES "../../../lib/comctl32/winetests/comctl32_test.exe"
|
118
reactos/apps/utils/winetest/util.c
Normal file
118
reactos/apps/utils/winetest/util.c
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Utility functions.
|
||||
*
|
||||
* Copyright 2003 Dimitrie O. Paun
|
||||
* Copyright 2003 Ferenc Wagner
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "winetest.h"
|
||||
|
||||
void *xmalloc (size_t len)
|
||||
{
|
||||
void *p = malloc (len);
|
||||
|
||||
if (!p) report (R_FATAL, "Out of memory.");
|
||||
return p;
|
||||
}
|
||||
|
||||
void *xrealloc (void *op, size_t len)
|
||||
{
|
||||
void *p = realloc (op, len);
|
||||
|
||||
if (!p) report (R_FATAL, "Out of memory.");
|
||||
return p;
|
||||
}
|
||||
|
||||
char *vstrfmtmake (size_t *lenp, const char *fmt, va_list ap)
|
||||
{
|
||||
size_t size = 1000;
|
||||
char *p, *q;
|
||||
int n;
|
||||
|
||||
p = malloc (size);
|
||||
if (!p) return NULL;
|
||||
while (1) {
|
||||
n = vsnprintf (p, size, fmt, ap);
|
||||
if (n < 0) size *= 2; /* Windows */
|
||||
else if ((unsigned)n >= size) size = n+1; /* glibc */
|
||||
else break;
|
||||
q = realloc (p, size);
|
||||
if (!q) {
|
||||
free (p);
|
||||
return NULL;
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
if (lenp) *lenp = n;
|
||||
return p;
|
||||
}
|
||||
|
||||
char *vstrmake (size_t *lenp, va_list ap)
|
||||
{
|
||||
const char *fmt;
|
||||
|
||||
fmt = va_arg (ap, const char*);
|
||||
return vstrfmtmake (lenp, fmt, ap);
|
||||
}
|
||||
|
||||
char *strmake (size_t *lenp, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *p;
|
||||
|
||||
va_start (ap, lenp);
|
||||
p = vstrmake (lenp, ap);
|
||||
if (!p) report (R_FATAL, "Out of memory.");
|
||||
va_end (ap);
|
||||
return p;
|
||||
}
|
||||
|
||||
void xprintf (const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
size_t size;
|
||||
ssize_t written;
|
||||
char *buffer, *head;
|
||||
|
||||
va_start (ap, fmt);
|
||||
buffer = vstrfmtmake (&size, fmt, ap);
|
||||
head = buffer;
|
||||
va_end (ap);
|
||||
while ((written = write (1, head, size)) != size) {
|
||||
if (written == -1)
|
||||
report (R_FATAL, "Can't write logs: %d", errno);
|
||||
head += written;
|
||||
size -= written;
|
||||
}
|
||||
free (buffer);
|
||||
}
|
||||
|
||||
const char *
|
||||
badtagchar (const char *tag)
|
||||
{
|
||||
while (*tag)
|
||||
if (('a'<=*tag && *tag<='z') ||
|
||||
('A'<=*tag && *tag<='Z') ||
|
||||
('0'<=*tag && *tag<='9') ||
|
||||
*tag=='-' || *tag=='.')
|
||||
tag++;
|
||||
else return tag;
|
||||
return NULL;
|
||||
}
|
BIN
reactos/apps/utils/winetest/wine.ico
Normal file
BIN
reactos/apps/utils/winetest/wine.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
61
reactos/apps/utils/winetest/winetest.h
Normal file
61
reactos/apps/utils/winetest/winetest.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* winetest definitions
|
||||
*
|
||||
* Copyright 2003 Dimitrie O. Paun
|
||||
* Copyright 2003 Ferenc Wagner
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __WINETESTS_H
|
||||
#define __WINETESTS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
void fatal (const char* msg);
|
||||
void warning (const char* msg);
|
||||
void *xmalloc (size_t len);
|
||||
void *xrealloc (void *op, size_t len);
|
||||
void xprintf (const char *fmt, ...);
|
||||
char *vstrmake (size_t *lenp, va_list ap);
|
||||
char *strmake (size_t *lenp, ...);
|
||||
const char *badtagchar (const char *tag);
|
||||
|
||||
int send_file (const char *name);
|
||||
|
||||
/* GUI definitions */
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
enum report_type {
|
||||
R_STATUS = 0,
|
||||
R_PROGRESS,
|
||||
R_STEP,
|
||||
R_DELTA,
|
||||
R_DIR,
|
||||
R_OUT,
|
||||
R_WARNING,
|
||||
R_ERROR,
|
||||
R_FATAL,
|
||||
R_ASK,
|
||||
R_TEXTMODE,
|
||||
R_QUIET
|
||||
};
|
||||
|
||||
int report (enum report_type t, ...);
|
||||
|
||||
#endif /* __WINETESTS_H */
|
132
reactos/apps/utils/winetest/winetest.rc
Normal file
132
reactos/apps/utils/winetest/winetest.rc
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Winetest resources
|
||||
*
|
||||
* Copyright 2004 Ferenc Wagner
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winres.h>
|
||||
#include "resource.h"
|
||||
#include "tests.rc"
|
||||
|
||||
IDD_STATUS DIALOG 0, 0, 160, 140
|
||||
STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX
|
||||
CAPTION "Wine Test Shell"
|
||||
BEGIN
|
||||
LTEXT "Extracting:", IDC_ST0, 10, 5, 140, 10
|
||||
CONTROL "PB0", IDC_PB0, PROGRESS_CLASS, 0, 5, 15, 150, 10
|
||||
LTEXT "Running:", IDC_ST1, 10, 30, 140, 10
|
||||
CONTROL "PB1", IDC_PB1, PROGRESS_CLASS, 0, 5, 40, 150, 15
|
||||
LTEXT "Network transfer:", IDC_ST2, 10, 60, 140, 10
|
||||
CONTROL "PB2", IDC_PB2, PROGRESS_CLASS, 0, 5, 70, 150, 10
|
||||
|
||||
LTEXT "Working directory:", IDC_STATIC, 10, 89, 100, 10
|
||||
EDITTEXT IDC_DIR, 71, 88, 79, 10,
|
||||
ES_READONLY | ES_AUTOHSCROLL
|
||||
LTEXT "Output file:", IDC_STATIC, 10, 100, 100, 10
|
||||
EDITTEXT IDC_OUT, 46, 99, 104, 10,
|
||||
ES_READONLY | ES_AUTOHSCROLL
|
||||
|
||||
DEFPUSHBUTTON "About", IDHELP, 20, 113, 30, 14
|
||||
PUSHBUTTON "Edit", IDCANCEL, 65, 113, 30, 14,
|
||||
WS_DISABLED
|
||||
PUSHBUTTON "Stop", IDABORT, 110, 113, 30, 14
|
||||
|
||||
CONTROL "Created", IDC_SB, STATUSCLASSNAME, 0, 0,0,0,0
|
||||
END
|
||||
|
||||
IDD_ABOUT DIALOG 0, 0, 150, 60
|
||||
STYLE WS_POPUP
|
||||
CAPTION "About Wine Test Shell"
|
||||
BEGIN
|
||||
CTEXT "This program extracts and runs a series of tests which check Wine's conformance to the Windows API.",
|
||||
IDC_STATIC, 10, 5, 130, 30
|
||||
DEFPUSHBUTTON "Close", IDCANCEL, 55, 40, 40, 14
|
||||
END
|
||||
|
||||
/* BINRES wine.ico */
|
||||
IDI_WINE ICON "wine.ico"
|
||||
/* {
|
||||
'00 00 01 00 02 00 20 20 10 00 00 00 00 00 E8 02'
|
||||
'00 00 26 00 00 00 10 10 10 00 00 00 00 00 28 01'
|
||||
'00 00 0E 03 00 00 28 00 00 00 20 00 00 00 40 00'
|
||||
'00 00 01 00 04 00 00 00 00 00 00 02 00 00 00 00'
|
||||
'00 00 00 00 00 00 10 00 00 00 00 00 00 00 39 02'
|
||||
'B1 00 23 02 6C 00 0F 03 29 00 1B 02 51 00 FF FF'
|
||||
'FF 00 1B 1A 1B 00 1E 02 63 00 33 02 A1 00 08 08'
|
||||
'08 00 14 03 3C 00 0C 04 1E 00 2E 02 8E 00 10 0F'
|
||||
'10 00 2A 02 82 00 29 02 7D 00 03 02 04 00 44 44'
|
||||
'44 44 44 44 44 44 55 44 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 8F FF 84 44 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 8F F8 F8 44 44 44 44 44 44 44 44 44 44'
|
||||
'44 44 8F FF F5 44 44 44 44 44 44 44 44 44 44 44'
|
||||
'44 5C F8 C8 F5 44 44 44 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 85 44 44 44 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 4C 44 44 44 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 4C 44 44 44 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 45 54 44 44 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 45 F4 44 44 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 45 FF 44 44 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 48 FF F4 44 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 48 23 9A 84 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 42 B7 7E AF 44 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 49 00 00 EA C4 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 46 00 00 01 F4 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 46 00 00 00 9F 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 46 00 70 00 EF 44 44 44 44 44 44 44'
|
||||
'44 44 44 44 43 00 00 00 79 F4 44 44 44 44 44 44'
|
||||
'44 44 44 44 49 00 00 00 0E F4 44 44 44 44 44 44'
|
||||
'44 44 44 44 42 00 00 00 07 24 44 44 44 44 44 44'
|
||||
'44 44 44 44 43 B0 00 00 00 34 44 44 44 44 44 44'
|
||||
'44 44 44 44 4C 30 00 00 00 1F 44 44 44 44 44 44'
|
||||
'44 44 44 44 48 27 E1 1D B1 2C 44 44 44 44 44 44'
|
||||
'44 44 44 44 44 A9 CC CF F8 48 C4 44 44 44 44 44'
|
||||
'44 44 44 44 44 58 44 44 44 45 C4 44 44 44 44 44'
|
||||
'44 44 44 44 44 4C 44 44 44 44 84 44 44 44 44 44'
|
||||
'44 44 44 44 44 48 44 44 44 44 C4 44 44 44 44 44'
|
||||
'44 44 44 44 44 48 C4 44 44 44 C4 44 44 44 44 44'
|
||||
'44 44 44 44 44 44 F4 44 44 4C C4 44 44 44 44 44'
|
||||
'44 44 44 44 44 44 84 44 F8 84 44 44 44 44 44 44'
|
||||
'44 44 44 44 44 44 48 F8 44 44 44 44 44 44 FF FF'
|
||||
'3F FF FF F0 7F FF FF C0 FF FF FF 03 FF FF FC 03'
|
||||
'FF FF FF F3 FF FF FF FB FF FF FF FB FF FF FF F9'
|
||||
'FF FF FF F9 FF FF FF F8 FF FF FF F8 7F FF FF F8'
|
||||
'1F FF FF F8 0F FF FF F8 07 FF FF F8 07 FF FF F8'
|
||||
'03 FF FF F8 03 FF FF F8 01 FF FF F8 01 FF FF F8'
|
||||
'01 FF FF F8 01 FF FF F8 00 FF FF F8 00 FF FF FC'
|
||||
'02 7F FF FC FE 7F FF FE FF 7F FF FE FF 7F FF FE'
|
||||
'7F 7F FF FF 7E 7F FF FF 71 FF FF FF 8F FF 28 00'
|
||||
'00 00 10 00 00 00 20 00 00 00 01 00 04 00 00 00'
|
||||
'00 00 80 00 00 00 00 00 00 00 00 00 00 00 10 00'
|
||||
'00 00 00 00 00 00 3A 02 B1 00 0A 06 14 00 12 03'
|
||||
'33 00 FF FF FF 00 12 12 12 00 0B 0B 0B 00 1B 1B'
|
||||
'1B 00 25 02 6F 00 2E 02 92 00 1A 02 52 00 36 02'
|
||||
'A6 00 15 03 3E 00 04 04 05 00 13 11 19 00 1E 02'
|
||||
'62 00 2A 02 82 00 33 33 33 CC 43 33 33 33 33 33'
|
||||
'CC 5C 33 33 33 33 33 36 C5 53 33 33 33 33 33 33'
|
||||
'33 43 33 33 33 33 33 33 33 65 33 33 33 33 33 33'
|
||||
'33 DC 33 33 33 33 33 33 33 17 EC 33 33 33 33 33'
|
||||
'33 B0 07 53 33 33 33 33 33 90 00 B3 33 33 33 33'
|
||||
'33 B0 00 FC 33 33 33 33 33 BA 00 A2 33 33 33 33'
|
||||
'33 C7 88 82 33 33 33 33 33 3D D5 14 43 33 33 33'
|
||||
'33 35 33 33 53 33 33 33 33 33 53 33 53 33 33 33'
|
||||
'33 33 C5 5C 33 33 FC 7F 00 00 F0 FF 00 00 E1 FF'
|
||||
'00 00 FD FF 00 00 FC FF 00 00 FC FF 00 00 FC 3F'
|
||||
'00 00 FC 1F 00 00 FC 1F 00 00 FC 0F 00 00 FC 0F'
|
||||
'00 00 FC 0F 00 00 FE 07 00 00 FE F7 00 00 FF 77'
|
||||
'00 00 FF 0F 00 00'
|
||||
} */
|
@@ -28,6 +28,7 @@
|
||||
#include "../../reactos/registry.h"
|
||||
#include "hardware.h"
|
||||
|
||||
BOOLEAN AcpiPresent = FALSE;
|
||||
|
||||
static BOOL
|
||||
FindAcpiBios(VOID)
|
||||
@@ -63,6 +64,7 @@ DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
|
||||
|
||||
if (FindAcpiBios())
|
||||
{
|
||||
AcpiPresent = TRUE;
|
||||
/* Create new bus key */
|
||||
sprintf(Buffer,
|
||||
"MultifunctionAdapter\\%u", *BusNumber);
|
||||
|
@@ -52,6 +52,7 @@
|
||||
#define MB_INFO_FLAG_BOOT_LOADER_NAME 0x00000200
|
||||
#define MB_INFO_FLAG_APM_TABLE 0x00000400
|
||||
#define MB_INFO_FLAG_GRAPHICS_TABLE 0x00000800
|
||||
#define MB_INFO_FLAG_ACPI_TABLE 0x00001000
|
||||
|
||||
#ifndef ASM
|
||||
/* Do not include here in boot.S. */
|
||||
|
@@ -164,9 +164,7 @@ FrLdrStartup(ULONG Magic)
|
||||
/* Re-initalize EFLAGS */
|
||||
Ke386EraseFlags();
|
||||
|
||||
/* Get Kernel Base and Set MmSystemRangeStart */
|
||||
FrLdrGetKernelBase();
|
||||
|
||||
/* Get the PAE Mode */
|
||||
FrLdrGetPaeMode();
|
||||
|
||||
/* Initialize the page directory */
|
||||
@@ -531,6 +529,14 @@ FrLdrMapKernel(FILE *KernelImage)
|
||||
ULONG_PTR TargetSection;
|
||||
ULONG SectionSize;
|
||||
LONG i;
|
||||
PIMAGE_DATA_DIRECTORY RelocationDDir;
|
||||
PIMAGE_BASE_RELOCATION RelocationDir, RelocationEnd;
|
||||
ULONG Count;
|
||||
ULONG_PTR Address, MaxAddress;
|
||||
PUSHORT TypeOffset;
|
||||
ULONG_PTR Delta;
|
||||
PUSHORT ShortPtr;
|
||||
PULONG LongPtr;
|
||||
|
||||
/* Allocate 1024 bytes for PE Header */
|
||||
ImageHeader = (PIMAGE_DOS_HEADER)MmAllocateMemory(1024);
|
||||
@@ -552,8 +558,9 @@ FrLdrMapKernel(FILE *KernelImage)
|
||||
/* Now read the MZ header to get the offset to the PE Header */
|
||||
NtHeader = (PIMAGE_NT_HEADERS)((PCHAR)ImageHeader + ImageHeader->e_lfanew);
|
||||
|
||||
/* Save the Image Base */
|
||||
KernelBase = NtHeader->OptionalHeader.ImageBase;
|
||||
/* Get Kernel Base */
|
||||
KernelBase = NtHeader->OptionalHeader.ImageBase;
|
||||
FrLdrGetKernelBase();
|
||||
|
||||
/* Save Entrypoint */
|
||||
KernelEntry = RaToPa(NtHeader->OptionalHeader.AddressOfEntryPoint);
|
||||
@@ -603,9 +610,64 @@ FrLdrMapKernel(FILE *KernelImage)
|
||||
Section->Misc.VirtualSize - Section->SizeOfRawData);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the Relocation Data Directory */
|
||||
RelocationDDir = &NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
|
||||
|
||||
/* Now relocate the file */
|
||||
/* FIXME: ADD RELOC CODE */
|
||||
/* Get the Relocation Section Start and End*/
|
||||
RelocationDir = (PIMAGE_BASE_RELOCATION)(KERNEL_BASE_PHYS + RelocationDDir->VirtualAddress);
|
||||
RelocationEnd = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)RelocationDir + RelocationDDir->Size);
|
||||
|
||||
/* Calculate Difference between Real Base and Compiled Base*/
|
||||
Delta = KernelBase - NtHeader->OptionalHeader.ImageBase;;
|
||||
|
||||
/* Determine how far we shoudl relocate */
|
||||
MaxAddress = KERNEL_BASE_PHYS + ImageSize;
|
||||
|
||||
/* Relocate until we've processed all the blocks */
|
||||
while (RelocationDir < RelocationEnd && RelocationDir->SizeOfBlock > 0) {
|
||||
|
||||
/* See how many Relocation Blocks we have */
|
||||
Count = (RelocationDir->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(USHORT);
|
||||
|
||||
/* Calculate the Address of this Directory */
|
||||
Address = KERNEL_BASE_PHYS + RelocationDir->VirtualAddress;
|
||||
|
||||
/* Calculate the Offset of the Type */
|
||||
TypeOffset = (PUSHORT)(RelocationDir + 1);
|
||||
|
||||
for (i = 0; i < Count; i++) {
|
||||
|
||||
ShortPtr = (PUSHORT)(Address + (*TypeOffset & 0xFFF));
|
||||
|
||||
/* Don't relocate after the end of the loaded driver */
|
||||
if ((ULONG_PTR)ShortPtr >= MaxAddress) break;
|
||||
|
||||
switch (*TypeOffset >> 12) {
|
||||
|
||||
case IMAGE_REL_BASED_ABSOLUTE:
|
||||
break;
|
||||
|
||||
case IMAGE_REL_BASED_HIGH:
|
||||
*ShortPtr += HIWORD(Delta);
|
||||
break;
|
||||
|
||||
case IMAGE_REL_BASED_LOW:
|
||||
*ShortPtr += LOWORD(Delta);
|
||||
break;
|
||||
|
||||
case IMAGE_REL_BASED_HIGHLOW:
|
||||
LongPtr = (PULONG)ShortPtr;
|
||||
*LongPtr += Delta;
|
||||
break;
|
||||
}
|
||||
|
||||
TypeOffset++;
|
||||
}
|
||||
|
||||
/* Move to the next Relocation Table */
|
||||
RelocationDir = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)RelocationDir + RelocationDir->SizeOfBlock);
|
||||
}
|
||||
|
||||
/* Increase the next Load Base */
|
||||
NextModuleBase = ROUND_UP(KERNEL_BASE_PHYS + ImageSize, PAGE_SIZE);
|
||||
|
@@ -578,8 +578,9 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
||||
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
||||
ULONG rosPartition;
|
||||
|
||||
extern ULONG PageDirectoryStart;
|
||||
extern ULONG PageDirectoryEnd;
|
||||
extern ULONG PageDirectoryStart;
|
||||
extern ULONG PageDirectoryEnd;
|
||||
extern BOOLEAN AcpiPresent;
|
||||
|
||||
//
|
||||
// Open the operating system section
|
||||
@@ -596,8 +597,8 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
||||
* Setup multiboot information structure
|
||||
*/
|
||||
LoaderBlock.Flags = MB_INFO_FLAG_MEM_SIZE | MB_INFO_FLAG_BOOT_DEVICE | MB_INFO_FLAG_COMMAND_LINE | MB_INFO_FLAG_MODULES;
|
||||
LoaderBlock.PageDirectoryStart = (ULONG)&PageDirectoryStart;
|
||||
LoaderBlock.PageDirectoryEnd = (ULONG)&PageDirectoryEnd;
|
||||
LoaderBlock.PageDirectoryStart = (ULONG)&PageDirectoryStart;
|
||||
LoaderBlock.PageDirectoryEnd = (ULONG)&PageDirectoryEnd;
|
||||
LoaderBlock.BootDevice = 0xffffffff;
|
||||
LoaderBlock.CommandLine = (unsigned long)multiboot_kernel_cmdline;
|
||||
LoaderBlock.ModsCount = 0;
|
||||
@@ -734,6 +735,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
||||
*/
|
||||
MachHwDetect();
|
||||
|
||||
if (AcpiPresent) LoaderBlock.Flags |= MB_INFO_FLAG_ACPI_TABLE;
|
||||
|
||||
UiDrawStatusText("Loading...");
|
||||
UiDrawProgressBarCenter(0, 100, "Loading ReactOS...");
|
||||
|
@@ -344,4 +344,133 @@ HKCR,"NDS\Clsid","",0x00000002,"{323991f0-7bad-11cf-b03d-00aa006e0975}"
|
||||
|
||||
HKCR,"WinNT\Clsid","",0x00000002,"{8b20cd60-0f29-11cf-abc4-02608c9e7553}"
|
||||
|
||||
|
||||
; For language support:
|
||||
|
||||
HKCR,"MIME",,0x00000012
|
||||
HKCR,"MIME\Database",,0x00000012
|
||||
HKCR,"MIME\Database\Rfc1766",,0x00000012
|
||||
HKCR,"MIME\Database\Rfc1766","0436",0x00000000,"af;Afrikaans"
|
||||
HKCR,"MIME\Database\Rfc1766","041C",0x00000000,"sq;Albanian"
|
||||
HKCR,"MIME\Database\Rfc1766","0001",0x00000000,"ar;Arabic"
|
||||
HKCR,"MIME\Database\Rfc1766","0401",0x00000000,"ar-sa;Arabic (Saudi Arabia)"
|
||||
HKCR,"MIME\Database\Rfc1766","0801",0x00000000,"ar-iq;Arabic (Iraq)"
|
||||
HKCR,"MIME\Database\Rfc1766","0C01",0x00000000,"ar-eg;Arabic (Egypt)"
|
||||
HKCR,"MIME\Database\Rfc1766","1001",0x00000000,"ar-ly;Arabic (Libya)"
|
||||
HKCR,"MIME\Database\Rfc1766","1401",0x00000000,"ar-dz;Arabic (Algeria)"
|
||||
HKCR,"MIME\Database\Rfc1766","1801",0x00000000,"ar-ma;Arabic (Morocco)"
|
||||
HKCR,"MIME\Database\Rfc1766","1C01",0x00000000,"ar-tn;Arabic (Tunisia)"
|
||||
HKCR,"MIME\Database\Rfc1766","2001",0x00000000,"ar-om;Arabic (Oman)"
|
||||
HKCR,"MIME\Database\Rfc1766","2401",0x00000000,"ar-ye;Arabic (Yemen)"
|
||||
HKCR,"MIME\Database\Rfc1766","2801",0x00000000,"ar-sy;Arabic (Syria)"
|
||||
HKCR,"MIME\Database\Rfc1766","2C01",0x00000000,"ar-jo;Arabic (Jordan)"
|
||||
HKCR,"MIME\Database\Rfc1766","3001",0x00000000,"ar-lb;Arabic (Lebanon)"
|
||||
HKCR,"MIME\Database\Rfc1766","3401",0x00000000,"ar-kw;Arabic (Kuwait)"
|
||||
HKCR,"MIME\Database\Rfc1766","3801",0x00000000,"ar-ae;Arabic (U.A.E.)"
|
||||
HKCR,"MIME\Database\Rfc1766","3C01",0x00000000,"ar-bh;Arabic (Bahrain)"
|
||||
HKCR,"MIME\Database\Rfc1766","4001",0x00000000,"ar-qa;Arabic (Qatar)"
|
||||
HKCR,"MIME\Database\Rfc1766","042D",0x00000000,"eu;Basque"
|
||||
HKCR,"MIME\Database\Rfc1766","0402",0x00000000,"bg;Bulgarian"
|
||||
HKCR,"MIME\Database\Rfc1766","0423",0x00000000,"be;Belarusian"
|
||||
HKCR,"MIME\Database\Rfc1766","0403",0x00000000,"ca;Catalan"
|
||||
HKCR,"MIME\Database\Rfc1766","0004",0x00000000,"zh;Chinese"
|
||||
HKCR,"MIME\Database\Rfc1766","0404",0x00000000,"zh-tw;Chinese (Taiwan)"
|
||||
HKCR,"MIME\Database\Rfc1766","0804",0x00000000,"zh-cn;Chinese (China)"
|
||||
HKCR,"MIME\Database\Rfc1766","0C04",0x00000000,"zh-hk;Chinese (Hong Kong SAR)"
|
||||
HKCR,"MIME\Database\Rfc1766","1004",0x00000000,"zh-sg;Chinese (Singapore)"
|
||||
HKCR,"MIME\Database\Rfc1766","041A",0x00000000,"hr;Croatian"
|
||||
HKCR,"MIME\Database\Rfc1766","0405",0x00000000,"cs;Czech"
|
||||
HKCR,"MIME\Database\Rfc1766","0406",0x00000000,"da;Danish"
|
||||
HKCR,"MIME\Database\Rfc1766","0413",0x00000000,"nl;Dutch (Netherlands)"
|
||||
HKCR,"MIME\Database\Rfc1766","0813",0x00000000,"nl-be;Dutch (Belgium)"
|
||||
HKCR,"MIME\Database\Rfc1766","0009",0x00000000,"en;English"
|
||||
HKCR,"MIME\Database\Rfc1766","0409",0x00000000,"en-us;English (United States)"
|
||||
HKCR,"MIME\Database\Rfc1766","0809",0x00000000,"en-gb;English (United Kingdom)"
|
||||
HKCR,"MIME\Database\Rfc1766","0C09",0x00000000,"en-au;English (Australia)"
|
||||
HKCR,"MIME\Database\Rfc1766","1009",0x00000000,"en-ca;English (Canada)"
|
||||
HKCR,"MIME\Database\Rfc1766","1409",0x00000000,"en-nz;English (New Zealand)"
|
||||
HKCR,"MIME\Database\Rfc1766","1809",0x00000000,"en-ie;English (Ireland)"
|
||||
HKCR,"MIME\Database\Rfc1766","1C09",0x00000000,"en-za;English (South Africa)"
|
||||
HKCR,"MIME\Database\Rfc1766","2009",0x00000000,"en-jm;English (Jamaica)"
|
||||
HKCR,"MIME\Database\Rfc1766","2809",0x00000000,"en-bz;English (Belize)"
|
||||
HKCR,"MIME\Database\Rfc1766","2C09",0x00000000,"en-tt;English (Trinidad)"
|
||||
HKCR,"MIME\Database\Rfc1766","0425",0x00000000,"et;Estonian"
|
||||
HKCR,"MIME\Database\Rfc1766","0438",0x00000000,"fo;Faeroese"
|
||||
HKCR,"MIME\Database\Rfc1766","0429",0x00000000,"fa;Farsi"
|
||||
HKCR,"MIME\Database\Rfc1766","040B",0x00000000,"fi;Finnish"
|
||||
HKCR,"MIME\Database\Rfc1766","040C",0x00000000,"fr;French (France)"
|
||||
HKCR,"MIME\Database\Rfc1766","080C",0x00000000,"fr-be;French (Belgium)"
|
||||
HKCR,"MIME\Database\Rfc1766","0C0C",0x00000000,"fr-ca;French (Canada)"
|
||||
HKCR,"MIME\Database\Rfc1766","100C",0x00000000,"fr-ch;French (Switzerland)"
|
||||
HKCR,"MIME\Database\Rfc1766","140C",0x00000000,"fr-lu;French (Luxembourg)"
|
||||
HKCR,"MIME\Database\Rfc1766","043C",0x00000000,"gd;Gaelic"
|
||||
HKCR,"MIME\Database\Rfc1766","0407",0x00000000,"de;German (Germany)"
|
||||
HKCR,"MIME\Database\Rfc1766","0807",0x00000000,"de-ch;German (Switzerland)"
|
||||
HKCR,"MIME\Database\Rfc1766","0C07",0x00000000,"de-at;German (Austria)"
|
||||
HKCR,"MIME\Database\Rfc1766","1007",0x00000000,"de-lu;German (Luxembourg)"
|
||||
HKCR,"MIME\Database\Rfc1766","1407",0x00000000,"de-li;German (Liechtenstein)"
|
||||
HKCR,"MIME\Database\Rfc1766","0408",0x00000000,"el;Greek"
|
||||
HKCR,"MIME\Database\Rfc1766","040D",0x00000000,"he;Hebrew"
|
||||
HKCR,"MIME\Database\Rfc1766","0439",0x00000000,"hi;Hindi"
|
||||
HKCR,"MIME\Database\Rfc1766","040E",0x00000000,"hu;Hungarian"
|
||||
HKCR,"MIME\Database\Rfc1766","040F",0x00000000,"is;Icelandic"
|
||||
HKCR,"MIME\Database\Rfc1766","0421",0x00000000,"in;Indonesian"
|
||||
HKCR,"MIME\Database\Rfc1766","0410",0x00000000,"it;Italian (Italy)"
|
||||
HKCR,"MIME\Database\Rfc1766","0810",0x00000000,"it-ch;Italian (Switzerland)"
|
||||
HKCR,"MIME\Database\Rfc1766","0411",0x00000000,"ja;Japanese"
|
||||
HKCR,"MIME\Database\Rfc1766","0412",0x00000000,"ko;Korean"
|
||||
HKCR,"MIME\Database\Rfc1766","0426",0x00000000,"lv;Latvian"
|
||||
HKCR,"MIME\Database\Rfc1766","0427",0x00000000,"lt;Lithuanian"
|
||||
HKCR,"MIME\Database\Rfc1766","042F",0x00000000,"mk;FYRO Macedonian"
|
||||
HKCR,"MIME\Database\Rfc1766","043E",0x00000000,"ms;Malay (Malaysia)"
|
||||
HKCR,"MIME\Database\Rfc1766","043A",0x00000000,"mt;Maltese"
|
||||
HKCR,"MIME\Database\Rfc1766","0414",0x00000000,"no;Norwegian (Bokmal)"
|
||||
HKCR,"MIME\Database\Rfc1766","0814",0x00000000,"no;Norwegian (Nynorsk)"
|
||||
HKCR,"MIME\Database\Rfc1766","0415",0x00000000,"pl;Polish"
|
||||
HKCR,"MIME\Database\Rfc1766","0416",0x00000000,"pt-br;Portuguese (Brazil)"
|
||||
HKCR,"MIME\Database\Rfc1766","0816",0x00000000,"pt;Portuguese (Portugal)"
|
||||
HKCR,"MIME\Database\Rfc1766","0417",0x00000000,"rm;Rhaeto-Romanic"
|
||||
HKCR,"MIME\Database\Rfc1766","0418",0x00000000,"ro;Romanian"
|
||||
HKCR,"MIME\Database\Rfc1766","0818",0x00000000,"ro-mo;Romanian (Moldova)"
|
||||
HKCR,"MIME\Database\Rfc1766","0419",0x00000000,"ru;Russian"
|
||||
HKCR,"MIME\Database\Rfc1766","0819",0x00000000,"ru-mo;Russian (Moldova)"
|
||||
HKCR,"MIME\Database\Rfc1766","0C1A",0x00000000,"sr;Serbian (Cyrillic)"
|
||||
HKCR,"MIME\Database\Rfc1766","081A",0x00000000,"sr;Serbian (Latin)"
|
||||
HKCR,"MIME\Database\Rfc1766","041B",0x00000000,"sk;Slovak"
|
||||
HKCR,"MIME\Database\Rfc1766","0424",0x00000000,"sl;Slovenian"
|
||||
HKCR,"MIME\Database\Rfc1766","042E",0x00000000,"sb;Sorbian"
|
||||
HKCR,"MIME\Database\Rfc1766","040A",0x00000000,"es;Spanish (Traditional Sort)"
|
||||
HKCR,"MIME\Database\Rfc1766","080A",0x00000000,"es-mx;Spanish (Mexico)"
|
||||
HKCR,"MIME\Database\Rfc1766","0C0A",0x00000000,"es;Spanish (International Sort)"
|
||||
HKCR,"MIME\Database\Rfc1766","100A",0x00000000,"es-gt;Spanish (Guatemala)"
|
||||
HKCR,"MIME\Database\Rfc1766","140A",0x00000000,"es-cr;Spanish (Costa Rica)"
|
||||
HKCR,"MIME\Database\Rfc1766","180A",0x00000000,"es-pa;Spanish (Panama)"
|
||||
HKCR,"MIME\Database\Rfc1766","1C0A",0x00000000,"es-do;Spanish (Dominican Republic)"
|
||||
HKCR,"MIME\Database\Rfc1766","200A",0x00000000,"es-ve;Spanish (Venezuela)"
|
||||
HKCR,"MIME\Database\Rfc1766","240A",0x00000000,"es-co;Spanish (Colombia)"
|
||||
HKCR,"MIME\Database\Rfc1766","280A",0x00000000,"es-pe;Spanish (Peru)"
|
||||
HKCR,"MIME\Database\Rfc1766","2C0A",0x00000000,"es-ar;Spanish (Argentina)"
|
||||
HKCR,"MIME\Database\Rfc1766","300A",0x00000000,"es-ec;Spanish (Ecuador)"
|
||||
HKCR,"MIME\Database\Rfc1766","340A",0x00000000,"es-cl;Spanish (Chile)"
|
||||
HKCR,"MIME\Database\Rfc1766","380A",0x00000000,"es-uy;Spanish (Uruguay)"
|
||||
HKCR,"MIME\Database\Rfc1766","3C0A",0x00000000,"es-py;Spanish (Paraguay)"
|
||||
HKCR,"MIME\Database\Rfc1766","400A",0x00000000,"es-bo;Spanish (Bolivia)"
|
||||
HKCR,"MIME\Database\Rfc1766","440A",0x00000000,"es-sv;Spanish (El Salvador)"
|
||||
HKCR,"MIME\Database\Rfc1766","480A",0x00000000,"es-hn;Spanish (Honduras)"
|
||||
HKCR,"MIME\Database\Rfc1766","4C0A",0x00000000,"es-ni;Spanish (Nicaragua)"
|
||||
HKCR,"MIME\Database\Rfc1766","500A",0x00000000,"es-pr;Spanish (Puerto Rico)"
|
||||
HKCR,"MIME\Database\Rfc1766","0430",0x00000000,"sx;Sutu"
|
||||
HKCR,"MIME\Database\Rfc1766","041D",0x00000000,"sv;Swedish"
|
||||
HKCR,"MIME\Database\Rfc1766","081D",0x00000000,"sv-fi;Swedish (Finland)"
|
||||
HKCR,"MIME\Database\Rfc1766","041E",0x00000000,"th;Thai"
|
||||
HKCR,"MIME\Database\Rfc1766","0431",0x00000000,"ts;Tsonga"
|
||||
HKCR,"MIME\Database\Rfc1766","0432",0x00000000,"tn;Tswana"
|
||||
HKCR,"MIME\Database\Rfc1766","041F",0x00000000,"tr;Turkish"
|
||||
HKCR,"MIME\Database\Rfc1766","0422",0x00000000,"uk;Ukrainian"
|
||||
HKCR,"MIME\Database\Rfc1766","0420",0x00000000,"ur;Urdu"
|
||||
HKCR,"MIME\Database\Rfc1766","042A",0x00000000,"vi;Vietnamese"
|
||||
HKCR,"MIME\Database\Rfc1766","0434",0x00000000,"xh;Xhosa"
|
||||
HKCR,"MIME\Database\Rfc1766","043D",0x00000000,"ji;Yiddish"
|
||||
HKCR,"MIME\Database\Rfc1766","0435",0x00000000,"zu;Zulu"
|
||||
|
||||
; EOF
|
||||
|
@@ -674,8 +674,13 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Null","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Group",0x00000000,"Base"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","ImagePath",0x00020000,"system32\drivers\serial.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Start",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Start",0x00010001,0x00000004
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Type",0x00010001,0x00000001
|
||||
;hard coded values
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial\Enum","0",0x00000000,"ACPI\PNP0501"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial\Enum","Count",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial\Enum","NextInstance",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\ACPI\PNP0501\0000","Service",0x00000000,"serial"
|
||||
|
||||
; Packet driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Packet","ErrorControl",0x00010001,0x00000001
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 25 KiB |
@@ -99,6 +99,7 @@ lib\mpr\mpr.dll 1
|
||||
lib\msacm\msacm32.dll 1
|
||||
lib\msafd\msafd.dll 1
|
||||
lib\msgina\msgina.dll 1
|
||||
lib\msi\msi.dll 1
|
||||
lib\msimg32\msimg32.dll 1
|
||||
lib\msvcrt\msvcrt.dll 1
|
||||
lib\msvcrt20\msvcrt20.dll 1
|
||||
@@ -108,6 +109,7 @@ lib\ole32\ole32.dll 1
|
||||
lib\oleaut32\oleaut32.dll 1
|
||||
lib\olepro32\olepro32.dll 1
|
||||
lib\psapi\psapi.dll 1
|
||||
lib\riched20\riched20.dll 1
|
||||
lib\richedit\riched32.dll 1
|
||||
lib\rpcrt4\rpcrt4.dll 1
|
||||
lib\samlib\samlib.dll 1
|
||||
@@ -146,8 +148,9 @@ subsys\system\cmd\cmd.exe 1
|
||||
subsys\system\explorer\explorer.exe 4
|
||||
subsys\system\explorer\explorer-cfg-template.xml 4
|
||||
subsys\system\explorer\notifyhook\notifyhook.dll 1
|
||||
subsys\system\ibrowser\ibrowser.exe 1
|
||||
subsys\system\format\format.exe 1
|
||||
subsys\system\ibrowser\ibrowser.exe 1
|
||||
subsys\system\msiexec\msiexec.exe 1
|
||||
subsys\system\notepad\notepad.exe 1
|
||||
subsys\system\regedit\regedit.exe 4
|
||||
subsys\system\regsvr32\regsvr32.exe 1
|
||||
|
@@ -5,7 +5,6 @@
|
||||
# Possible values in the future: alpha,i386,m68k,mips,powerpc
|
||||
ARCH := i386
|
||||
|
||||
|
||||
#
|
||||
# Which cpu should reactos optimize for
|
||||
# example : i486, i586, pentium, pentium2, pentium3, pentium4
|
||||
@@ -15,7 +14,7 @@ ARCH := i386
|
||||
# be optimized for.
|
||||
#
|
||||
|
||||
OARCH := i486
|
||||
OARCH := i586
|
||||
|
||||
#
|
||||
# Whether to compile in the kernel debugger
|
||||
@@ -27,26 +26,11 @@ KDBG := 0
|
||||
#
|
||||
DBG := 0
|
||||
|
||||
#
|
||||
# Whether to compile with optimizations
|
||||
#
|
||||
OPTIMIZED := 0
|
||||
|
||||
#
|
||||
# Whether to compile a multiprocessor or single processor version
|
||||
#
|
||||
CONFIG_SMP := 0
|
||||
|
||||
#
|
||||
# Whether to compile for ACPI compliant systems
|
||||
#
|
||||
ACPI := 0
|
||||
|
||||
#
|
||||
# whether to use a 3GB User, 1GB Kernel memory map
|
||||
#
|
||||
3GB := 0
|
||||
|
||||
#
|
||||
# Which version of NDIS do we support up to?
|
||||
#
|
||||
|
@@ -26,52 +26,55 @@ This will allow you to use the WINE tools and librarys with very little
|
||||
work to import a new dll.
|
||||
|
||||
The following build tools are derived from Wine.
|
||||
reactos/tools/unicode # Synced to Wine-20050310
|
||||
reactos/tools/wpp # Synced to Wine-20050310
|
||||
reactos/tools/bin2res # Resource to binary converter
|
||||
reactos/tools/winebuild # Synced to Wine-20050211
|
||||
reactos/tools/winebuild # Synced to Wine-20050310
|
||||
reactos/tools/wmc # Wine Message Compiler
|
||||
reactos/tools/wrc # Synced to Wine-20050211
|
||||
reactos/tools/wrc # Synced to Wine-20050310
|
||||
reactos/tools/widl # Synced to Wine-20050310
|
||||
|
||||
The following shared libraries are a 100% port from Winehq sources.
|
||||
|
||||
reactos/lib/cabinet # Synced to Wine-20050211
|
||||
reactos/lib/comctl32 # Synced to Wine-20050211
|
||||
reactos/lib/comdlg32 # Synced to Wine-20050211
|
||||
reactos/lib/dinput # Synced to Wine-20050211
|
||||
reactos/lib/dinput8 # Synced to Wine-20050211
|
||||
reactos/lib/icmp # Synced to Wine-20050211
|
||||
reactos/lib/cabinet # Synced to Wine-20050310
|
||||
reactos/lib/comctl32 # Synced to Wine-20050310
|
||||
reactos/lib/comdlg32 # Synced to Wine-20050310
|
||||
reactos/lib/dinput # Synced to Wine-20050310
|
||||
reactos/lib/dinput8 # Synced to Wine-20050310
|
||||
reactos/lib/icmp # Synced to Wine-20050310
|
||||
reactos/lib/iphlpapi # Out of sync
|
||||
reactos/lib/imagehlp # Patches for BindImage need review and submission to winehq.
|
||||
reactos/lib/msvcrt20 # Out of sync
|
||||
reactos/lib/mpr # Synced to Wine-20050211
|
||||
reactos/lib/mpr # Synced to Wine-20050310
|
||||
reactos/lib/msacm # Out of sync
|
||||
reactos/lib/msimg32 # Synced to Wine-20050211
|
||||
reactos/lib/msi # Synced to Wine-20050211
|
||||
reactos/lib/msimg32 # Synced to Wine-20050310
|
||||
reactos/lib/msi # Synced to Wine-20050310
|
||||
reactos/lib/msvideo # Out of sync
|
||||
reactos/lib/netapi32 # Out of sync
|
||||
reactos/lib/odbc32 # In sync. Depends on port of Linux ODBC.
|
||||
reactos/lib/ole32 # Synced to Wine-20050211
|
||||
reactos/lib/oleaut32 # Synced to Wine-20050211
|
||||
reactos/lib/oledlg # Synced to Wine-20050211
|
||||
reactos/lib/olepro32 # Synced to Wine-20050211
|
||||
reactos/lib/richedit # Synced to Wine-20050211
|
||||
reactos/lib/rpcrt4 # Synced to Wine-20050211
|
||||
reactos/lib/setupapi # Synced to Wine-20050125 # CVS
|
||||
reactos/lib/shell32 # Synced to Wine-20050211
|
||||
reactos/lib/shdocvw # Synced to Wine-20050211
|
||||
reactos/lib/shlwapi # Synced to Wine-20050211
|
||||
reactos/lib/ole32 # Synced to Wine-20050310
|
||||
reactos/lib/oleaut32 # Synced to Wine-20050310
|
||||
reactos/lib/oledlg # Synced to Wine-20050310
|
||||
reactos/lib/olepro32 # Synced to Wine-20050310
|
||||
reactos/lib/riched20 # Synced to Wine-20050310
|
||||
reactos/lib/richedit # Synced to Wine-20050310
|
||||
reactos/lib/rpcrt4 # Synced to Wine-20050310
|
||||
reactos/lib/setupapi # Synced to Wine-20050310
|
||||
reactos/lib/shell32 # Synced to Wine-20050310
|
||||
reactos/lib/shdocvw # Synced to Wine-20050310
|
||||
reactos/lib/shlwapi # Synced to Wine-20050310
|
||||
reactos/lib/twain # Out of sync
|
||||
reactos/lib/unicode # Dependancy on this lib needs to be removed. Synced to Wine-20050211
|
||||
reactos/lib/urlmon # Synced to Wine-20050211
|
||||
reactos/lib/urlmon # Synced to Wine-20050310
|
||||
reactos/lib/version # Out of sync
|
||||
reactos/lib/wininet # Out of sync
|
||||
reactos/lib/winmm # Synced to Wine-20050211
|
||||
reactos/lib/winmm/midimap # Synced to Wine-20050211
|
||||
reactos/lib/winmm/wavemap # Synced to Wine-20050211
|
||||
reactos/lib/winmm # Synced to Wine-20050310
|
||||
reactos/lib/winmm/midimap # Synced to Wine-20050310
|
||||
reactos/lib/winmm/wavemap # Synced to Wine-20050310
|
||||
|
||||
ReactOS shares the following programs with Winehq.
|
||||
reactos/subsys/system/regedit # Out of sync
|
||||
reactos/subsys/system/expand # Out of sync
|
||||
reactos/subsys/system/msiexec # Synced to Wine-20050211
|
||||
reactos/subsys/system/msiexec # Synced to Wine-20050311
|
||||
|
||||
In addition the following libs, dlls and source files are mostly based on code ported
|
||||
from Winehq CVS. If you are looking to update something in these files
|
||||
|
@@ -126,7 +126,7 @@ FdoQueryBusRelations(
|
||||
ANSI_STRING AnsiString;
|
||||
ACPI_STATUS AcpiStatus;
|
||||
PACPI_DEVICE Device;
|
||||
NTSTATUS Status;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
BM_NODE *Node;
|
||||
ULONG Size;
|
||||
ULONG i;
|
||||
|
@@ -601,5 +601,5 @@ acpi_os_writable(void *ptr, u32 len)
|
||||
u32
|
||||
acpi_os_get_thread_id (void)
|
||||
{
|
||||
return (ULONG)PsGetCurrentThreadId();
|
||||
return (ULONG)PsGetCurrentThreadId() + 1;
|
||||
}
|
||||
|
@@ -389,6 +389,7 @@ acpi_cm_init_globals (
|
||||
acpi_gbl_acpi_mutex_info[i].mutex = NULL;
|
||||
acpi_gbl_acpi_mutex_info[i].locked = FALSE;
|
||||
acpi_gbl_acpi_mutex_info[i].use_count = 0;
|
||||
acpi_gbl_acpi_mutex_info[i].owner_id = 0;
|
||||
}
|
||||
|
||||
/* Global notify handlers */
|
||||
|
22
reactos/drivers/dd/serial/cleanup.c
Normal file
22
reactos/drivers/dd/serial/cleanup.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/cleanup.c
|
||||
* PURPOSE: Serial IRP_MJ_CLEANUP operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialCleanup(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
DPRINT("Serial: IRP_MJ_CLEANUP\n");
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
29
reactos/drivers/dd/serial/close.c
Normal file
29
reactos/drivers/dd/serial/close.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/close.c
|
||||
* PURPOSE: Serial IRP_MJ_CLOSE operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialClose(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PSERIAL_DEVICE_EXTENSION pDeviceExtension;
|
||||
|
||||
DPRINT("Serial: IRP_MJ_CLOSE\n");
|
||||
pDeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
pDeviceExtension->IsOpened = FALSE;
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
60
reactos/drivers/dd/serial/create.c
Normal file
60
reactos/drivers/dd/serial/create.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/create.c
|
||||
* PURPOSE: Serial IRP_MJ_CREATE operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialCreate(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Serial: IRP_MJ_CREATE\n");
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = Stack->FileObject;
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
|
||||
{
|
||||
CHECKPOINT;
|
||||
Status = STATUS_NOT_A_DIRECTORY;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
if (FileObject->FileName.Length != 0 ||
|
||||
FileObject->RelatedFileObject != NULL)
|
||||
{
|
||||
CHECKPOINT;
|
||||
Status = STATUS_ACCESS_DENIED;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
if(DeviceExtension->IsOpened)
|
||||
{
|
||||
DPRINT("Serial: COM%lu is already opened", DeviceExtension->ComPort);
|
||||
Status = STATUS_ACCESS_DENIED;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
DPRINT("Serial: open COM%lu: successfull\n", DeviceExtension->ComPort);
|
||||
DeviceExtension->IsOpened = TRUE;
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
ByeBye:
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
595
reactos/drivers/dd/serial/devctrl.c
Normal file
595
reactos/drivers/dd/serial/devctrl.c
Normal file
@@ -0,0 +1,595 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/devctrl.c
|
||||
* PURPOSE: Serial IRP_MJ_DEVICE_CONTROL operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
/* FIXME: call IoAcquireRemoveLock/IoReleaseRemoveLock around each I/O operation */
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialSetBaudRate(
|
||||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension,
|
||||
IN ULONG NewBaudRate)
|
||||
{
|
||||
USHORT divisor;
|
||||
PUCHAR ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
if (NewBaudRate & SERIAL_BAUD_USER)
|
||||
{
|
||||
divisor = (USHORT)(BAUD_CLOCK / (CLOCKS_PER_BIT * (NewBaudRate & ~SERIAL_BAUD_USER)));
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (NewBaudRate)
|
||||
{
|
||||
case SERIAL_BAUD_075: divisor = 0x600; break;
|
||||
case SERIAL_BAUD_110: divisor = 0x400; break;
|
||||
case SERIAL_BAUD_134_5: divisor = 0x360; break;
|
||||
case SERIAL_BAUD_150: divisor = 0x300; break;
|
||||
case SERIAL_BAUD_300: divisor = 0x180; break;
|
||||
case SERIAL_BAUD_600: divisor = 0xc0; break;
|
||||
case SERIAL_BAUD_1200: divisor = 0x60; break;
|
||||
case SERIAL_BAUD_1800: divisor = 0x40; break;
|
||||
case SERIAL_BAUD_2400: divisor = 0x30; break;
|
||||
case SERIAL_BAUD_4800: divisor = 0x18; break;
|
||||
case SERIAL_BAUD_7200: divisor = 0x10; break;
|
||||
case SERIAL_BAUD_9600: divisor = 0xc; break;
|
||||
case SERIAL_BAUD_14400: divisor = 0x8; break;
|
||||
case SERIAL_BAUD_38400: divisor = 0x3; break;
|
||||
case SERIAL_BAUD_57600: divisor = 0x2; break;
|
||||
case SERIAL_BAUD_115200: divisor = 0x1; break;
|
||||
case SERIAL_BAUD_56K: divisor = 0x2; break;
|
||||
case SERIAL_BAUD_128K: divisor = 0x1; break;
|
||||
default: Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
UCHAR Lcr;
|
||||
DPRINT("Serial: SerialSetBaudRate(COM%lu, %lu Bauds)\n", DeviceExtension->ComPort, BAUD_CLOCK / (CLOCKS_PER_BIT * divisor));
|
||||
/* FIXME: update DeviceExtension->LowerDevice when modifying LCR? */
|
||||
/* Set Bit 7 of LCR to expose baud registers */
|
||||
Lcr = READ_PORT_UCHAR(SER_LCR(ComPortBase));
|
||||
Lcr |= SR_LCR_DLAB;
|
||||
WRITE_PORT_UCHAR(SER_LCR(ComPortBase), Lcr);
|
||||
/* Write the baud rate */
|
||||
WRITE_PORT_UCHAR(SER_DLL(ComPortBase), divisor & 0xff);
|
||||
WRITE_PORT_UCHAR(SER_DLM(ComPortBase), divisor >> 8);
|
||||
/* Switch back to normal registers */
|
||||
Lcr ^= SR_LCR_DLAB;
|
||||
WRITE_PORT_UCHAR(SER_LCR(ComPortBase), Lcr);
|
||||
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
}
|
||||
}
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
DeviceExtension->BaudRate = NewBaudRate;
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialSetLineControl(
|
||||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension,
|
||||
IN PSERIAL_LINE_CONTROL NewSettings)
|
||||
{
|
||||
UCHAR Lcr = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Serial: SerialSetLineControl(COM%lu, Settings { %lu %lu %lu })\n",
|
||||
DeviceExtension->ComPort, NewSettings->StopBits, NewSettings->Parity, NewSettings->WordLength);
|
||||
|
||||
/* Verify parameters */
|
||||
switch (NewSettings->WordLength)
|
||||
{
|
||||
case 5: Lcr |= SR_LCR_CS5; break;
|
||||
case 6: Lcr |= SR_LCR_CS6; break;
|
||||
case 7: Lcr |= SR_LCR_CS7; break;
|
||||
case 8: Lcr |= SR_LCR_CS8; break;
|
||||
default: return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (NewSettings->WordLength < 5 || NewSettings->WordLength > 8)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
switch (NewSettings->Parity)
|
||||
{
|
||||
case NO_PARITY: Lcr |= SR_LCR_PNO; break;
|
||||
case ODD_PARITY: Lcr |= SR_LCR_POD; break;
|
||||
case EVEN_PARITY: Lcr |= SR_LCR_PEV; break;
|
||||
case MARK_PARITY: Lcr |= SR_LCR_PMK; break;
|
||||
case SPACE_PARITY: Lcr |= SR_LCR_PSP; break;
|
||||
default: return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
switch (NewSettings->StopBits)
|
||||
{
|
||||
case STOP_BIT_1:
|
||||
Lcr |= SR_LCR_ST1;
|
||||
break;
|
||||
case STOP_BITS_1_5:
|
||||
if (NewSettings->WordLength != 5)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
Lcr |= SR_LCR_ST2;
|
||||
break;
|
||||
case STOP_BITS_2:
|
||||
if (NewSettings->WordLength < 6 || NewSettings->WordLength > 8)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
Lcr |= SR_LCR_ST2;
|
||||
break;
|
||||
default:
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Update current parameters */
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
WRITE_PORT_UCHAR(SER_LCR((PUCHAR)DeviceExtension->BaseAddress), Lcr);
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
DeviceExtension->SerialLineControl = *NewSettings;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
BOOL
|
||||
SerialClearPerfStats(
|
||||
IN PSERIALPERF_STATS pSerialPerfStats)
|
||||
{
|
||||
RtlZeroMemory(pSerialPerfStats, sizeof(SERIALPERF_STATS));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
SerialGetPerfStats(IN PIRP pIrp)
|
||||
{
|
||||
PSERIAL_DEVICE_EXTENSION pDeviceExtension;
|
||||
pDeviceExtension = (PSERIAL_DEVICE_EXTENSION)
|
||||
IoGetCurrentIrpStackLocation(pIrp)->DeviceObject->DeviceExtension;
|
||||
/*
|
||||
* we assume buffer is big enough to hold SerialPerfStats structure
|
||||
* caller must verify this
|
||||
*/
|
||||
RtlCopyMemory(
|
||||
pIrp->AssociatedIrp.SystemBuffer,
|
||||
&pDeviceExtension->SerialPerfStats,
|
||||
sizeof(SERIALPERF_STATS)
|
||||
);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialDeviceControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
ULONG LengthIn, LengthOut;
|
||||
ULONG Information = 0;
|
||||
PUCHAR Buffer;
|
||||
PUCHAR ComPortBase;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Serial: IRP_MJ_DEVICE_CONTROL dispatch\n");
|
||||
|
||||
/* FIXME: pend operation if possible */
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
LengthIn = Stack->Parameters.DeviceIoControl.InputBufferLength;
|
||||
LengthOut = Stack->Parameters.DeviceIoControl.OutputBufferLength;
|
||||
Buffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
/* FIXME: need to probe buffers */
|
||||
/* FIXME: see http://www.osronline.com/ddkx/serial/serref_61bm.htm */
|
||||
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
|
||||
{
|
||||
case IOCTL_SERIAL_CLEAR_STATS:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_CLEAR_STATS\n");
|
||||
KeSynchronizeExecution(
|
||||
DeviceExtension->Interrupt,
|
||||
(PKSYNCHRONIZE_ROUTINE)SerialClearPerfStats,
|
||||
&DeviceExtension->SerialPerfStats);
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_CLR_DTR:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_CLR_DTR\n");
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
* automatically use DTR, return STATUS_INVALID_PARAMETER */
|
||||
DeviceExtension->MCR &= ~SR_MCR_DTR;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_CLR_RTS:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_CLR_RTS\n");
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
* automatically use RTS, return STATUS_INVALID_PARAMETER */
|
||||
DeviceExtension->MCR &= ~SR_MCR_RTS;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_CONFIG_SIZE:
|
||||
{
|
||||
/* Obsolete on Microsoft Windows 2000+ */
|
||||
PULONG pConfigSize;
|
||||
DPRINT("Serial: IOCTL_SERIAL_CONFIG_SIZE\n");
|
||||
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pConfigSize = (PULONG)Buffer;
|
||||
*pConfigSize = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_BAUD_RATE:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_BAUD_RATE\n");
|
||||
if (LengthOut < sizeof(SERIAL_BAUD_RATE))
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
else if (Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
((PSERIAL_BAUD_RATE)Buffer)->BaudRate = DeviceExtension->BaudRate;
|
||||
Information = sizeof(SERIAL_BAUD_RATE);
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
case IOCTL_SERIAL_GET_CHARS:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_GET_CHARS not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_COMMSTATUS:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_GET_COMMSTATUS not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_DTRRTS:
|
||||
{
|
||||
PULONG pDtrRts;
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_DTRRTS\n");
|
||||
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pDtrRts = (PULONG)Buffer;
|
||||
*pDtrRts = 0;
|
||||
if (DeviceExtension->MCR & SR_MCR_DTR)
|
||||
*pDtrRts |= SERIAL_DTR_STATE;
|
||||
if (DeviceExtension->MCR & SR_MCR_RTS)
|
||||
*pDtrRts |= SERIAL_RTS_STATE;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_HANDFLOW:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_GET_HANDFLOW not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_LINE_CONTROL:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_LINE_CONTROL\n");
|
||||
if (LengthOut < sizeof(SERIAL_LINE_CONTROL))
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
else if (Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
*((PSERIAL_LINE_CONTROL)Buffer) = DeviceExtension->SerialLineControl;
|
||||
Information = sizeof(SERIAL_LINE_CONTROL);
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_MODEM_CONTROL:
|
||||
{
|
||||
PULONG pMCR;
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_MODEM_CONTROL\n");
|
||||
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pMCR = (PULONG)Buffer;
|
||||
*pMCR = DeviceExtension->MCR;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_MODEMSTATUS:
|
||||
{
|
||||
PULONG pMSR;
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_MODEMSTATUS\n");
|
||||
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pMSR = (PULONG)Buffer;
|
||||
*pMSR = DeviceExtension->MSR;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_PROPERTIES:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_GET_PROPERTIES not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_STATS:
|
||||
{
|
||||
DPRINT1("Serial: IOCTL_SERIAL_GET_STATS\n");
|
||||
if (LengthOut < sizeof(SERIALPERF_STATS))
|
||||
{
|
||||
DPRINT("Serial: return STATUS_BUFFER_TOO_SMALL\n");
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
else if (Buffer == NULL)
|
||||
{
|
||||
DPRINT("Serial: return STATUS_INVALID_PARAMETER\n");
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
KeSynchronizeExecution(DeviceExtension->Interrupt,
|
||||
(PKSYNCHRONIZE_ROUTINE)SerialGetPerfStats, Irp);
|
||||
Status = STATUS_SUCCESS;
|
||||
Information = sizeof(SERIALPERF_STATS);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_TIMEOUTS:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_GET_TIMEOUTS not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_WAIT_MASK:
|
||||
{
|
||||
PULONG pWaitMask;
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_WAIT_MASK\n");
|
||||
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pWaitMask = (PULONG)Buffer;
|
||||
*pWaitMask = DeviceExtension->WaitMask;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_IMMEDIATE_CHAR:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_IMMEDIATE_CHAR not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_LSRMST_INSERT:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_LSRMST_INSERT not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_PURGE:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_PURGE not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_RESET_DEVICE:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_RESET_DEVICE not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_BAUD_RATE:
|
||||
{
|
||||
PULONG pNewBaudRate;
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_BAUD_RATE\n");
|
||||
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pNewBaudRate = (PULONG)Buffer;
|
||||
Status = SerialSetBaudRate(DeviceExtension, *pNewBaudRate);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_BREAK_OFF:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_SET_BREAK_OFF not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_BREAK_ON:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_SET_BREAK_ON not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_CHARS:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_SET_CHARS not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_DTR:
|
||||
{
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
* automatically use DTR, return STATUS_INVALID_PARAMETER */
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_DTR\n");
|
||||
if (!(DeviceExtension->MCR & SR_MCR_DTR))
|
||||
{
|
||||
DeviceExtension->MCR |= SR_MCR_DTR;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
}
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_FIFO_CONTROL:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_FIFO_CONTROL\n");
|
||||
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
WRITE_PORT_UCHAR(SER_FCR(ComPortBase), (UCHAR)((*(PULONG)Buffer) & 0xff));
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_HANDFLOW:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_SET_HANDFLOW not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_LINE_CONTROL:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_LINE_CONTROL\n");
|
||||
if (LengthIn < sizeof(SERIAL_LINE_CONTROL))
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
else if (Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
Status = SerialSetLineControl(DeviceExtension, (PSERIAL_LINE_CONTROL)Buffer);
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_MODEM_CONTROL:
|
||||
{
|
||||
PULONG pMCR;
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_MODEM_CONTROL\n");
|
||||
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pMCR = (PULONG)Buffer;
|
||||
DeviceExtension->MCR = (UCHAR)(*pMCR & 0xff);
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_QUEUE_SIZE:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_SET_QUEUE_SIZE not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_RTS:
|
||||
{
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
* automatically use DTR, return STATUS_INVALID_PARAMETER */
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_RTS\n");
|
||||
if (!(DeviceExtension->MCR & SR_MCR_RTS))
|
||||
{
|
||||
DeviceExtension->MCR |= SR_MCR_RTS;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
}
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_TIMEOUTS:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_SET_TIMEOUTS not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_WAIT_MASK:
|
||||
{
|
||||
PULONG pWaitMask;
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_WAIT_MASK\n");
|
||||
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pWaitMask = (PULONG)Buffer;
|
||||
DeviceExtension->WaitMask = *pWaitMask;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_XOFF:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_SET_XOFF not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_XON:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_SET_XON not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_WAIT_ON_MASK:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_WAIT_ON_MASK not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_XOFF_COUNTER:
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT1("Serial: IOCTL_SERIAL_XOFF_COUNTER not implemented.\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
/* Pass Irp to lower driver */
|
||||
DPRINT("Serial: Unknown IOCTL code 0x%x\n", Stack->Parameters.DeviceIoControl.IoControlCode);
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
return IoCallDriver(DeviceExtension->LowerDevice, Irp);
|
||||
}
|
||||
}
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
79
reactos/drivers/dd/serial/info.c
Normal file
79
reactos/drivers/dd/serial/info.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/info.c
|
||||
* PURPOSE: Serial IRP_MJ_QUERY_INFORMATION operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
#define NDEBUG2
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialQueryInformation(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PVOID SystemBuffer;
|
||||
ULONG BufferLength;
|
||||
NTSTATUS Status;
|
||||
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
BufferLength = Stack->Parameters.QueryFile.Length;
|
||||
|
||||
switch (Stack->Parameters.QueryFile.FileInformationClass)
|
||||
{
|
||||
case FileStandardInformation:
|
||||
{
|
||||
PFILE_STANDARD_INFORMATION StandardInfo = (PFILE_STANDARD_INFORMATION)SystemBuffer;
|
||||
|
||||
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FileStandardInformation\n");
|
||||
if (BufferLength < sizeof(FILE_STANDARD_INFORMATION))
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
else
|
||||
{
|
||||
StandardInfo->AllocationSize.QuadPart = 0;
|
||||
StandardInfo->EndOfFile.QuadPart = 0;
|
||||
StandardInfo->Directory = FALSE;
|
||||
StandardInfo->NumberOfLinks = 0;
|
||||
StandardInfo->DeletePending = FALSE; /* FIXME: should be TRUE sometimes */
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
}
|
||||
case FilePositionInformation:
|
||||
{
|
||||
PFILE_POSITION_INFORMATION PositionInfo = (PFILE_POSITION_INFORMATION)SystemBuffer;
|
||||
|
||||
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FilePositionInformation\n");
|
||||
if (BufferLength < sizeof(PFILE_POSITION_INFORMATION))
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
else
|
||||
{
|
||||
PositionInfo->CurrentByteOffset.QuadPart = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION: Unexpected file information class 0x%02x\n", Stack->Parameters.QueryFile.FileInformationClass);
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
Status = IoCallDriver(DeviceExtension->LowerDevice, Irp);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
@@ -6,7 +6,17 @@ TARGET_TYPE = driver
|
||||
|
||||
TARGET_NAME = serial
|
||||
|
||||
TARGET_OBJECTS = serial.o
|
||||
TARGET_OBJECTS = \
|
||||
cleanup.o \
|
||||
close.o \
|
||||
create.o \
|
||||
devctrl.o \
|
||||
info.o \
|
||||
misc.o \
|
||||
pnp.o \
|
||||
power.o \
|
||||
rw.o \
|
||||
serial.o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API
|
||||
|
||||
|
176
reactos/drivers/dd/serial/misc.c
Normal file
176
reactos/drivers/dd/serial/misc.c
Normal file
@@ -0,0 +1,176 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/misc.c
|
||||
* PURPOSE: Misceallenous operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS
|
||||
ForwardIrpAndWaitCompletion(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
IN PVOID Context)
|
||||
{
|
||||
if (Irp->PendingReturned)
|
||||
KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE);
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ForwardIrpAndWait(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PDEVICE_OBJECT LowerDevice = ((PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
||||
KEVENT Event;
|
||||
NTSTATUS Status;
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
IoCopyCurrentIrpStackLocationToNext(Irp);
|
||||
|
||||
DPRINT("Serial: Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
|
||||
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
|
||||
|
||||
Status = IoCallDriver(LowerDevice, Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
Status = KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
||||
if (NT_SUCCESS(Status))
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
BOOLEAN STDCALL
|
||||
SerialInterruptService(
|
||||
IN PKINTERRUPT Interrupt,
|
||||
IN OUT PVOID ServiceContext)
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
PUCHAR ComPortBase;
|
||||
UCHAR Iir;
|
||||
|
||||
DeviceObject = (PDEVICE_OBJECT)ServiceContext;
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
DPRINT1("Serial: Maybe our interrupt?\n"); /* FIXME */
|
||||
|
||||
Iir = READ_PORT_UCHAR(SER_IIR(ComPortBase));
|
||||
#if 0
|
||||
if (Iir == 0xff)
|
||||
return TRUE;
|
||||
CHECKPOINT1;
|
||||
Iir &= SR_IIR_ID_MASK;
|
||||
if (!(Iir & SR_IIR_SELF)) { return FALSE; }
|
||||
CHECKPOINT1;
|
||||
#else
|
||||
Iir &= SR_IIR_ID_MASK;
|
||||
Iir |= SR_IIR_SELF;
|
||||
#endif
|
||||
DPRINT1("Serial: Iir = 0x%x\n", Iir);
|
||||
|
||||
switch (Iir)
|
||||
{
|
||||
case SR_IIR_MSR_CHANGE:
|
||||
{
|
||||
DPRINT1("Serial: SR_IIR_MSR_CHANGE\n");
|
||||
DeviceExtension->MSR = READ_PORT_UCHAR(SER_MSR(ComPortBase));
|
||||
/* FIXME: what to do? */
|
||||
//return KeInsertQueueDpc (&Self->MsrChangeDpc, Self, 0);
|
||||
//return TRUE;
|
||||
break;
|
||||
}
|
||||
case SR_IIR_THR_EMPTY:
|
||||
{
|
||||
DPRINT1("Serial: SR_IIR_THR_EMPTY\n");
|
||||
break;
|
||||
/*if (!Self->WaitingSendBytes.Empty() &&
|
||||
(READ_PORT_UCHAR( Self->Port + UART_LSR ) & LSR_THR_EMPTY) )
|
||||
WRITE_PORT_UCHAR( Self->Port + UART_THR,
|
||||
Self->WaitingSendBytes.PopFront() );
|
||||
return KeInsertQueueDpc( &Self->TransmitDpc, Self, 0 );*/
|
||||
}
|
||||
case SR_IIR_DATA_RECEIVED:
|
||||
{
|
||||
DPRINT1("Serial: SR_IIR_DATA_RECEIVED\n");
|
||||
if (READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_DR)
|
||||
{
|
||||
DPRINT1("Serial: Byte received: 0x%x\n", READ_PORT_UCHAR(SER_RBR(ComPortBase)));
|
||||
DeviceExtension->SerialPerfStats.ReceivedCount++;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
/*if( READ_PORT_UCHAR( Self->Port + UART_LSR ) & LSR_DATA_RECEIVED )
|
||||
Self->WaitingReadBytes.PushBack
|
||||
( READ_PORT_UCHAR( Self->Port + UART_RDR ) );
|
||||
return KeInsertQueueDpc( &Self->DataInDpc, Self, 0 );*/
|
||||
}
|
||||
case SR_IIR_ERROR:
|
||||
{
|
||||
DPRINT1("Serial: SR_IIR_ERROR\n");
|
||||
break;
|
||||
/*Error = READ_PORT_UCHAR( Self->Port + UART_LSR );
|
||||
if( Error & LSR_OVERRUN )
|
||||
Self->WaitingReadBytes.PushBack( SerialFifo::OVERRUN );
|
||||
if( Error & LSR_PARITY_ERROR )
|
||||
Self->WaitingReadBytes.PushBack( SerialFifo::PARITY );
|
||||
if( Error & LSR_FRAMING_ERROR )
|
||||
Self->WaitingReadBytes.PushBack( SerialFifo::FRAMING );
|
||||
if( Error & LSR_BREAK )
|
||||
Self->WaitingReadBytes.PushBack( SerialFifo::BREAK );
|
||||
if( Error & LSR_TIMEOUT )
|
||||
Self->WaitingReadBytes.PushBack( SerialFifo::TIMEOUT );
|
||||
return KeInsertQueueDpc( &Self->DataInDpc, Self, 0 );*/
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
#if 0
|
||||
InterruptId = READ_PORT_UCHAR(SER_IIR(ComPortBase)) & SR_IIR_IID;
|
||||
DPRINT1("Serial: Interrupt catched: id = %x\n", InterruptId);
|
||||
/* FIXME: sometimes, update DeviceExtension->IER */
|
||||
/* FIXME: sometimes, update DeviceExtension->MCR */
|
||||
/* FIXME: sometimes, update DeviceExtension->MSR */
|
||||
switch (InterruptId)
|
||||
{
|
||||
case 3 << 1:
|
||||
{
|
||||
/* line status changed */
|
||||
DPRINT("Serial: Line status changed\n");
|
||||
break;
|
||||
}
|
||||
case 2 << 1:
|
||||
{
|
||||
/* data available */
|
||||
UCHAR ReceivedByte = READ_PORT_UCHAR(ComPortBase);
|
||||
DPRINT("Serial: Data available\n");
|
||||
DPRINT1("Serial: received %d\n", ReceivedByte);
|
||||
//Buffer[Information++] = ReceivedByte;
|
||||
}
|
||||
case 1 << 1:
|
||||
{
|
||||
/* transmit register empty */
|
||||
DPRINT("Serial: Transmit register empty\n");
|
||||
}
|
||||
case 0 << 1:
|
||||
{
|
||||
/* modem status change */
|
||||
UCHAR ReceivedByte = READ_PORT_UCHAR(SER_MSR(ComPortBase));
|
||||
DPRINT("Serial: Modem status change\n");
|
||||
DPRINT1("Serial: new status = 0x%02x\n", ReceivedByte);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
277
reactos/drivers/dd/serial/pnp.c
Normal file
277
reactos/drivers/dd/serial/pnp.c
Normal file
@@ -0,0 +1,277 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/pnp.c
|
||||
* PURPOSE: Serial IRP_MJ_PNP operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
/* FIXME: call IoAcquireRemoveLock/IoReleaseRemoveLock around each I/O operation */
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialAddDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT Pdo)
|
||||
{
|
||||
PDEVICE_OBJECT Fdo;
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
WCHAR DeviceNameBuffer[32];
|
||||
UNICODE_STRING DeviceName;
|
||||
static ULONG DeviceNumber = 0;
|
||||
|
||||
DPRINT("Serial: SerialAddDevice called\n");
|
||||
|
||||
/* Create new device object */
|
||||
swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceNumber);
|
||||
RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(SERIAL_DEVICE_EXTENSION),
|
||||
&DeviceName,
|
||||
FILE_DEVICE_SERIAL_PORT,
|
||||
FILE_DEVICE_SECURE_OPEN,
|
||||
FALSE,
|
||||
&Fdo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: IoCreateDevice() failed with status 0x%08x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Register device interface */
|
||||
/* FIXME */
|
||||
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(SERIAL_DEVICE_EXTENSION));
|
||||
DeviceExtension->SerialPortNumber = DeviceNumber++;
|
||||
DeviceExtension->Pdo = Pdo;
|
||||
DeviceExtension->PnpState = dsStopped;
|
||||
IoInitializeRemoveLock(&DeviceExtension->RemoveLock, SERIAL_TAG, 0, 0);
|
||||
//Fdo->Flags |= DO_POWER_PAGEABLE (or DO_POWER_INRUSH?)
|
||||
Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: IoAttachDeviceToDeviceStackSafe() failed with status 0x%08x\n", Status);
|
||||
IoDeleteDevice(Fdo);
|
||||
return Status;
|
||||
}
|
||||
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialPnpStartDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
WCHAR DeviceNameBuffer[32];
|
||||
UNICODE_STRING DeviceName;
|
||||
WCHAR LinkNameBuffer[32];
|
||||
UNICODE_STRING LinkName;
|
||||
ULONG Vector;
|
||||
KIRQL Dirql;
|
||||
KAFFINITY Affinity;
|
||||
NTSTATUS Status;
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
ResourceList = Stack->Parameters.StartDevice.AllocatedResources/*Translated*/;
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
/* FIXME: actually, IRP_MN_START_DEVICE is sent twice to each serial device:
|
||||
* - one when loading serial.sys
|
||||
* - one when loading attached upper filter serenum.sys
|
||||
* This behaviour MUST NOT exist.
|
||||
* As PnP handling isn't right anyway, I didn't search how to correct this.
|
||||
*/
|
||||
if (DeviceExtension->PnpState == dsStarted) return STATUS_SUCCESS;
|
||||
|
||||
if (ResourceList == NULL)
|
||||
{
|
||||
/* FIXME: PnP isn't correctly implemented and doesn't give us a list
|
||||
* of our own resources. Use default values instead.
|
||||
*/
|
||||
switch (DeviceExtension->SerialPortNumber)
|
||||
{
|
||||
case 0:
|
||||
DPRINT("Serial: creating COM1:\n");
|
||||
DeviceExtension->ComPort = 3;
|
||||
DeviceExtension->BaudRate = 19200 | SERIAL_BAUD_USER;
|
||||
DeviceExtension->BaseAddress = 0x3F8;
|
||||
DeviceExtension->Irq = 4;
|
||||
break;
|
||||
case 1:
|
||||
DPRINT("Serial: creating COM2:\n");
|
||||
DeviceExtension->ComPort = 4;
|
||||
DeviceExtension->BaudRate = 19200 | SERIAL_BAUD_USER;
|
||||
DeviceExtension->BaseAddress = 0x2F8;
|
||||
DeviceExtension->Irq = 3;
|
||||
break;
|
||||
default:
|
||||
DPRINT1("Serial: unknown port?\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
{
|
||||
DPRINT1("ResourceList %p, ResourceListTranslated %p\n", Stack->Parameters.StartDevice.AllocatedResources, Stack->Parameters.StartDevice.AllocatedResourcesTranslated);
|
||||
for (i = 0; i < ResourceList->Count; i++)
|
||||
{
|
||||
DPRINT1("Interface type = 0x%x\n", ResourceList->List[i].InterfaceType);
|
||||
DPRINT1("Bus number = 0x%x\n", ResourceList->List[i].BusNumber);
|
||||
for (j = 0; i < ResourceList->List[i].PartialResourceList.Count; j++)
|
||||
{
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor = &ResourceList->List[i].PartialResourceList.PartialDescriptors[j];
|
||||
DPRINT1("Type 0x%x, Share disposition 0x%x, Flags 0x%x\n",
|
||||
PartialDescriptor->Type,
|
||||
PartialDescriptor->ShareDisposition,
|
||||
PartialDescriptor->Flags);
|
||||
switch (PartialDescriptor->Type)
|
||||
{
|
||||
case CmResourceTypePort:
|
||||
DeviceExtension->BaseAddress = PartialDescriptor->u.Port.Start.u.LowPart;
|
||||
break;
|
||||
case CmResourceTypeInterrupt:
|
||||
/* FIXME: Detect if interrupt is shareable and/or latched */
|
||||
/* FIXME: use also ->u.Interrupt.Vector and ->u.Interrupt.Affinity
|
||||
* to remove call to HalGetInterruptVector(...) */
|
||||
DeviceExtension->Irq = PartialDescriptor->u.Interrupt.Level;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* FIXME: use polling if no interrupt was found? */
|
||||
DeviceExtension->ComPort = 5; /* FIXME: use incremental value, or find it in resource list*/
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Get current settings */
|
||||
DeviceExtension->IER = READ_PORT_UCHAR(SER_IER((PUCHAR)DeviceExtension->BaseAddress));
|
||||
DeviceExtension->MCR = READ_PORT_UCHAR(SER_MCR((PUCHAR)DeviceExtension->BaseAddress));
|
||||
DeviceExtension->MSR = READ_PORT_UCHAR(SER_MSR((PUCHAR)DeviceExtension->BaseAddress));
|
||||
DeviceExtension->SerialLineControl.StopBits = STOP_BIT_1;
|
||||
DeviceExtension->SerialLineControl.Parity = NO_PARITY;
|
||||
DeviceExtension->SerialLineControl.WordLength = 8;
|
||||
DeviceExtension->WaitMask = 0;
|
||||
|
||||
/* Set baud rate */
|
||||
Status = SerialSetBaudRate(DeviceExtension, 19200 | SERIAL_BAUD_USER); /* FIXME: real default value? */
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: SerialSetBaudRate() failed with status 0x%08x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Set line control */
|
||||
Status = SerialSetLineControl(DeviceExtension, &DeviceExtension->SerialLineControl);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: SerialSetLineControl() failed with status 0x%08x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Create link \DosDevices\COMX -> \Device\SerialX */
|
||||
swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceExtension->SerialPortNumber);
|
||||
RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
|
||||
swprintf(LinkNameBuffer, L"\\DosDevices\\COM%lu", DeviceExtension->ComPort);
|
||||
RtlInitUnicodeString(&LinkName, LinkNameBuffer);
|
||||
Status = IoCreateSymbolicLink(&LinkName, &DeviceName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: IoCreateSymbolicLink() failed with status 0x%08x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Connect interrupt and enable them */
|
||||
Vector = HalGetInterruptVector(Internal, 0, 0, DeviceExtension->Irq, &Dirql, &Affinity);
|
||||
Status = IoConnectInterrupt(
|
||||
&DeviceExtension->Interrupt, SerialInterruptService,
|
||||
DeviceObject, NULL, Vector, Dirql, Dirql, Latched,
|
||||
FALSE /* FIXME: or TRUE to share interrupt on PCI bus? */,
|
||||
Affinity, FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: IoConnectInterrupt() failed with status 0x%08x\n", Status);
|
||||
IoDeleteSymbolicLink(&LinkName);
|
||||
return Status;
|
||||
}
|
||||
DeviceExtension->IER |= 0x1; /* Activate interrupt mode */
|
||||
WRITE_PORT_UCHAR(SER_IER((PUCHAR)DeviceExtension->BaseAddress), DeviceExtension->IER);
|
||||
|
||||
DeviceExtension->PnpState = dsStarted;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialPnp(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
ULONG MinorFunction;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
ULONG Information = 0;
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
NTSTATUS Status;
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
MinorFunction = Stack->MinorFunction;
|
||||
LowerDevice = ((PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
||||
|
||||
switch (MinorFunction)
|
||||
{
|
||||
case IRP_MN_START_DEVICE:
|
||||
{
|
||||
DPRINT("Serial: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
|
||||
|
||||
/* Call lower driver */
|
||||
Status = ForwardIrpAndWait(DeviceObject, Irp);
|
||||
if (NT_SUCCESS(Status))
|
||||
Status = SerialPnpStartDevice(DeviceObject, Irp);
|
||||
break;
|
||||
}
|
||||
/* IRP_MN_QUERY_STOP_DEVICE (FIXME: required) */
|
||||
/* IRP_MN_STOP_DEVICE (FIXME: required) */
|
||||
/* IRP_MN_CANCEL_STOP_DEVICE (FIXME: required) */
|
||||
/* IRP_MN_QUERY_REMOVE_DEVICE (FIXME: required) */
|
||||
/* case IRP_MN_REMOVE_DEVICE (FIXME: required) */
|
||||
/*{
|
||||
DPRINT("Serial: IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
|
||||
IoAcquireRemoveLock
|
||||
IoReleaseRemoveLockAndWait
|
||||
pass request to DeviceExtension-LowerDriver
|
||||
IoDeleteDevice(Fdo) and/or IoDetachDevice
|
||||
break;
|
||||
}*/
|
||||
/* IRP_MN_CANCEL_REMOVE_DEVICE (FIXME: required) */
|
||||
/* IRP_MN_SURPRISE_REMOVAL (FIXME: required) */
|
||||
/* IRP_MN_QUERY_CAPABILITIES (optional) */
|
||||
/* IRP_MN_QUERY_PNP_DEVICE_STATE (optional) */
|
||||
/* IRP_MN_FILTER_RESOURCE_REQUIREMENTS (optional) */
|
||||
/* IRP_MN_DEVICE_USAGE_NOTIFICATION (FIXME: required or optional ???) */
|
||||
/* IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations (optional) */
|
||||
/* IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations (optional) */
|
||||
/* IRP_MN_QUERY_INTERFACE (optional) */
|
||||
default:
|
||||
{
|
||||
DPRINT1("Serial: unknown minor function 0x%x\n", MinorFunction);
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
Status = IoCallDriver(LowerDevice, Irp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
22
reactos/drivers/dd/serial/power.c
Normal file
22
reactos/drivers/dd/serial/power.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/power.c
|
||||
* PURPOSE: Serial IRP_MJ_POWER operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialPower(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
DPRINT("Serial: IRP_MJ_POWER dispatch\n");
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
94
reactos/drivers/dd/serial/rw.c
Normal file
94
reactos/drivers/dd/serial/rw.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/create.c
|
||||
* PURPOSE: Serial IRP_MJ_READ/IRP_MJ_WRITE operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
/* FIXME: call IoAcquireRemoveLock/IoReleaseRemoveLock around each I/O operation */
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
static PVOID
|
||||
SerialGetUserBuffer(IN PIRP Irp)
|
||||
{
|
||||
ASSERT(Irp);
|
||||
|
||||
if (Irp->MdlAddress)
|
||||
return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority);
|
||||
else
|
||||
/* FIXME: try buffer */
|
||||
return Irp->UserBuffer;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialRead(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
ULONG Information = 0;
|
||||
NTSTATUS Status = STATUS_NOT_IMPLEMENTED;
|
||||
|
||||
DPRINT1("Serial: IRP_MJ_READ unimplemented\n");
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialWrite(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
ULONG Length;
|
||||
ULONG Information = 0;
|
||||
PUCHAR Buffer;
|
||||
PUCHAR ComPortBase;
|
||||
ULONG i;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
DPRINT("Serial: IRP_MJ_WRITE\n");
|
||||
|
||||
/* FIXME: pend operation if possible */
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
Length = Stack->Parameters.Write.Length;
|
||||
Buffer = SerialGetUserBuffer(Irp);
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
if (Stack->Parameters.Write.ByteOffset.QuadPart != 0 || Buffer == NULL)
|
||||
{
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (!NT_SUCCESS(Status))
|
||||
goto ByeBye;
|
||||
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
/* verify if output buffer is not full */
|
||||
while ((READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_TBE) == 0)
|
||||
;
|
||||
WRITE_PORT_UCHAR(SER_THR(ComPortBase), Buffer[i]);
|
||||
DeviceExtension->SerialPerfStats.TransmittedCount++;
|
||||
}
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
|
||||
Information = Length;
|
||||
|
||||
ByeBye:
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
@@ -1,160 +1,44 @@
|
||||
/* $Id$
|
||||
*
|
||||
* Serial driver
|
||||
* Written by Jason Filby (jasonfilby@yahoo.com)
|
||||
* For ReactOS (www.reactos.com)
|
||||
*
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/serial.c
|
||||
* PURPOSE: Serial driver loading/unloading
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
/* FIXME: call IoAcquireRemoveLock/IoReleaseRemoveLock around each I/O operation */
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
//#include <internal/mmhal.h>
|
||||
//#include "../../../ntoskrnl/include/internal/i386/io.h"
|
||||
//#include "../../../ntoskrnl/include/internal/io.h"
|
||||
//#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
#define outb_p(a,p) WRITE_PORT_UCHAR((PUCHAR)a,p)
|
||||
#define outw_p(a,p) WRITE_PORT_USHORT((PUSHORT)a,p)
|
||||
#define inb_p(p) READ_PORT_UCHAR((PUCHAR)p)
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
#define COM1 0x3F8
|
||||
#define COM2 0x2F8
|
||||
#define COM3 0x3E8
|
||||
#define COM4 0x2E8
|
||||
|
||||
#define UART_BAUDRATE 96 // 1200 BPS
|
||||
#define UART_LCRVAL 0x1b // 0x1b for 8e1
|
||||
#define UARY_FCRVAL 0x7
|
||||
|
||||
int uart_detect(unsigned base)
|
||||
VOID STDCALL
|
||||
DriverUnload(IN PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
// Returns 0 if no UART detected
|
||||
|
||||
outb_p(base+4, 0x10);
|
||||
if ((inb_p(base+6) & 0xf0)) return 0;
|
||||
return 1;
|
||||
};
|
||||
|
||||
int irq_setup(unsigned base)
|
||||
{
|
||||
// Returns -1 if not found -- otherwise returns interrupt level
|
||||
|
||||
char ier, mcr, imrm, imrs, maskm, masks, irqm, irqs;
|
||||
|
||||
__asm("cli"); // disable all CPU interrupts
|
||||
ier = inb_p(base+1); // read IER
|
||||
outb_p(base+1,0); // disable all UART ints
|
||||
while (!(inb_p(base+5)&0x20)); // wait for the THR to be empty
|
||||
mcr = inb_p(base+4); // read MCR
|
||||
outb_p(base+4,0x0F); // connect UART to irq line
|
||||
imrm = inb_p(0x21); // read contents of master ICU mask register
|
||||
imrs = inb_p(0xA1); // read contents of slave ICU mask register
|
||||
outb_p(0xA0,0x0A); // next read access to 0xA0 reads out IRR
|
||||
outb_p(0x20,0x0A); // next read access to 0x20 reads out IRR
|
||||
outb_p(base+1,2); // let's generate interrupts...
|
||||
maskm = inb_p(0x20); // this clears all bits except for the one
|
||||
masks = inb_p(0xA0); // that corresponds to the int
|
||||
outb_p(base+1,0); // drop the int line
|
||||
maskm &= ~inb_p(0x20); // this clears all bits except for the one
|
||||
masks &= ~inb_p(0xA0); // that corresponds to the int
|
||||
outb_p(base+1,2); // and raise it again just to be sure...
|
||||
maskm &= inb_p(0x20); // this clears all bits except for the one
|
||||
masks &= inb_p(0xA0); // that corresponds to the int
|
||||
outb_p(0xA1,~masks); // now let us unmask this interrupt only
|
||||
outb_p(0x21,~maskm);
|
||||
outb_p(0xA0,0x0C); // enter polled mode
|
||||
outb_p(0x20,0x0C); // that order is important with Pentium/PCI systems
|
||||
irqs = inb_p(0xA0); // and accept the interrupt
|
||||
irqm = inb_p(0x20);
|
||||
inb_p(base+2); // reset transmitter interrupt in UART
|
||||
outb_p(base+4,mcr); // restore old value of MCR
|
||||
outb_p(base+1,ier); // restore old value of IER
|
||||
if (masks) outb_p(0xA0,0x20); // send an EOI to slave
|
||||
if (maskm) outb_p(0x20,0x20); // send an EOI to master
|
||||
outb_p(0x21,imrm); // restore old mask register contents
|
||||
outb_p(0xA1,imrs);
|
||||
__asm("sti");
|
||||
if (irqs&0x80) // slave interrupt occured
|
||||
return (irqs&0x07)+8;
|
||||
if (irqm&0x80) // master interrupt occured
|
||||
return irqm&0x07;
|
||||
return -1;
|
||||
};
|
||||
|
||||
void uart_init(unsigned uart_base)
|
||||
{
|
||||
// Initialize the UART
|
||||
outb_p(uart_base+3, 0x80);
|
||||
outw_p(uart_base, UART_BAUDRATE);
|
||||
outb_p(uart_base+3, UART_LCRVAL);
|
||||
outb_p(uart_base+4, 0);
|
||||
};
|
||||
|
||||
unsigned uart_getchar(unsigned uart_base)
|
||||
{
|
||||
unsigned x;
|
||||
|
||||
x=(inb_p(uart_base+5) & 0x9f) << 8;
|
||||
if(x & 0x100) x|=((unsigned)inb_p(uart_base)) & 0xff;
|
||||
return x;
|
||||
};
|
||||
|
||||
void InitializeSerial(void)
|
||||
{
|
||||
unsigned comports[4] = { COM1, COM2, COM3, COM4 };
|
||||
char *comname[4] = { "COM1", "COM2", "COM3", "COM4" };
|
||||
int i, irq_level;
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
if(uart_detect(comports[i])==0)
|
||||
{
|
||||
DbgPrint("%s not detected\n", comname[i]);
|
||||
} else {
|
||||
uart_init(comports[i]);
|
||||
irq_level=irq_setup(comports[i]);
|
||||
if(irq_level==-1)
|
||||
{
|
||||
DbgPrint("Warning: IRQ not detected!\n");
|
||||
} else {
|
||||
DbgPrint("%s hooked to interrupt level %d\n", comname[i], irq_level);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// For testing purposes
|
||||
void testserial(void)
|
||||
{
|
||||
int i=0;
|
||||
char testc;
|
||||
|
||||
union {
|
||||
unsigned val;
|
||||
char character;
|
||||
} x;
|
||||
|
||||
DbgPrint("Testing serial input...\n");
|
||||
|
||||
while(i==0) {
|
||||
x.val=uart_getchar(COM1);
|
||||
// if(!x.val) continue;
|
||||
// if(x.val & 0x100)
|
||||
|
||||
testc=inb_p(COM1);
|
||||
|
||||
// DbgPrint("(%x-%c) %c\n", x.val, x.character, testc);
|
||||
};
|
||||
};
|
||||
// nothing to do here yet
|
||||
}
|
||||
|
||||
/*
|
||||
* Standard DriverEntry method.
|
||||
*/
|
||||
NTSTATUS STDCALL
|
||||
DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||
DriverEntry(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PUNICODE_STRING RegPath)
|
||||
{
|
||||
DbgPrint("Serial Driver 0.0.2\n");
|
||||
// InitializeSerial();
|
||||
// testserial();
|
||||
return(STATUS_SUCCESS);
|
||||
};
|
||||
DriverObject->DriverUnload = DriverUnload;
|
||||
DriverObject->DriverExtension->AddDevice = SerialAddDevice;
|
||||
|
||||
/* FIXME: send all other major functions to lower driver */
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = SerialCreate;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = SerialClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = SerialCleanup;
|
||||
DriverObject->MajorFunction[IRP_MJ_READ] = SerialRead;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = SerialWrite;
|
||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = SerialDeviceControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = SerialQueryInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = SerialPnp;
|
||||
DriverObject->MajorFunction[IRP_MJ_POWER] = SerialPower;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
211
reactos/drivers/dd/serial/serial.h
Normal file
211
reactos/drivers/dd/serial/serial.h
Normal file
@@ -0,0 +1,211 @@
|
||||
#if defined(__GNUC__)
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/ntddser.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
/* FIXME: this prototype MUST NOT be here! */
|
||||
NTSTATUS STDCALL
|
||||
IoAttachDeviceToDeviceStackSafe(
|
||||
IN PDEVICE_OBJECT SourceDevice,
|
||||
IN PDEVICE_OBJECT TargetDevice,
|
||||
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
|
||||
#elif defined(_MSC_VER)
|
||||
#include <ntddk.h>
|
||||
#include <ntddser.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define STDCALL
|
||||
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
|
||||
#define CHECKPOINT1 DbgPrint("(%s:%d)\n")
|
||||
|
||||
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||
|
||||
NTSTATUS STDCALL
|
||||
IoAttachDeviceToDeviceStackSafe(
|
||||
IN PDEVICE_OBJECT SourceDevice,
|
||||
IN PDEVICE_OBJECT TargetDevice,
|
||||
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
|
||||
|
||||
#ifdef NDEBUG2
|
||||
#define DPRINT
|
||||
#define CHECKPOINT
|
||||
#else
|
||||
#define DPRINT DPRINT1
|
||||
#define CHECKPOINT CHECKPOINT1
|
||||
#undef NDEBUG
|
||||
#endif
|
||||
#else
|
||||
#error Unknown compiler!
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
dsStopped,
|
||||
dsStarted,
|
||||
dsPaused,
|
||||
dsRemoved,
|
||||
dsSurpriseRemoved
|
||||
} SERIAL_DEVICE_STATE;
|
||||
|
||||
typedef struct _SERIAL_DEVICE_EXTENSION
|
||||
{
|
||||
PDEVICE_OBJECT Pdo;
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
SERIAL_DEVICE_STATE PnpState;
|
||||
IO_REMOVE_LOCK RemoveLock;
|
||||
|
||||
ULONG SerialPortNumber;
|
||||
|
||||
ULONG ComPort; /* FIXME: move to serenum */
|
||||
ULONG BaudRate;
|
||||
ULONG BaseAddress;
|
||||
ULONG Irq;
|
||||
PKINTERRUPT Interrupt;
|
||||
|
||||
SERIAL_LINE_CONTROL SerialLineControl;
|
||||
ULONG WaitMask;
|
||||
|
||||
SERIALPERF_STATS SerialPerfStats;
|
||||
BOOL IsOpened;
|
||||
|
||||
/* Current values */
|
||||
UCHAR IER; /* Base+1, Interrupt Enable Register */
|
||||
UCHAR MCR; /* Base+4, Modem Control Register */
|
||||
UCHAR MSR; /* Base+6, Modem Status Register */
|
||||
} SERIAL_DEVICE_EXTENSION, *PSERIAL_DEVICE_EXTENSION;
|
||||
|
||||
#define SERIAL_TAG TAG('S', 'e', 'r', 'l')
|
||||
|
||||
/* Baud master clock */
|
||||
#define BAUD_CLOCK 1843200
|
||||
#define CLOCKS_PER_BIT 16
|
||||
|
||||
/* UART registers and bits */
|
||||
#define SER_RBR(x) ((x)+0)
|
||||
#define SER_THR(x) ((x)+0)
|
||||
#define SER_DLL(x) ((x)+0)
|
||||
#define SER_IER(x) ((x)+1)
|
||||
#define SER_DLM(x) ((x)+1)
|
||||
#define SER_FCR(x) ((x)+1)
|
||||
#define SER_IIR(x) ((x)+2)
|
||||
#define SR_IIR_SELF 0x01
|
||||
#define SR_IIR_ID_MASK 0x07
|
||||
#define SR_IIR_MSR_CHANGE SR_IIR_SELF
|
||||
#define SR_IIR_THR_EMPTY (SR_IIR_SELF | 2)
|
||||
#define SR_IIR_DATA_RECEIVED (SR_IIR_SELF | 4)
|
||||
#define SR_IIR_ERROR (SR_IIR_SELF | 6)
|
||||
#define SER_LCR(x) ((x)+3)
|
||||
#define SR_LCR_CS5 0x00
|
||||
#define SR_LCR_CS6 0x01
|
||||
#define SR_LCR_CS7 0x02
|
||||
#define SR_LCR_CS8 0x03
|
||||
#define SR_LCR_ST1 0x00
|
||||
#define SR_LCR_ST2 0x04
|
||||
#define SR_LCR_PNO 0x00
|
||||
#define SR_LCR_POD 0x08
|
||||
#define SR_LCR_PEV 0x18
|
||||
#define SR_LCR_PMK 0x28
|
||||
#define SR_LCR_PSP 0x38
|
||||
#define SR_LCR_BRK 0x40
|
||||
#define SR_LCR_DLAB 0x80
|
||||
#define SER_MCR(x) ((x)+4)
|
||||
#define SR_MCR_DTR 0x01
|
||||
#define SR_MCR_RTS 0x02
|
||||
#define SER_LSR(x) ((x)+5)
|
||||
#define SR_LSR_DR 0x01
|
||||
#define SR_LSR_TBE 0x20
|
||||
#define SER_MSR(x) ((x)+6)
|
||||
#define SR_MSR_CTS 0x10
|
||||
#define SR_MSR_DSR 0x20
|
||||
#define SER_SCR(x) ((x)+7)
|
||||
|
||||
/************************************ cleanup.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialCleanup(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
/************************************ close.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialClose(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
/************************************ create.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialCreate(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
/************************************ devctrl.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialDeviceControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialSetBaudRate(
|
||||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension,
|
||||
IN ULONG NewBaudRate);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialSetLineControl(
|
||||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension,
|
||||
IN PSERIAL_LINE_CONTROL NewSettings);
|
||||
|
||||
/************************************ info.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialQueryInformation(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
/************************************ misc.c */
|
||||
|
||||
NTSTATUS
|
||||
ForwardIrpAndWait(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
BOOLEAN STDCALL
|
||||
SerialInterruptService(
|
||||
IN PKINTERRUPT Interrupt,
|
||||
IN OUT PVOID ServiceContext);
|
||||
|
||||
/************************************ pnp.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialAddDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT Pdo);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialPnp(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
/************************************ power.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialPower(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
/************************************ rw.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialRead(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialWrite(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
@@ -87,9 +87,8 @@ NpfsSignalAndRemoveListeningServerInstance(PNPFS_PIPE Pipe,
|
||||
{
|
||||
DPRINT("Server found! Fcb %p\n", Waiter->Fcb);
|
||||
|
||||
KeSetEvent(Waiter->Irp->UserEvent, 0, FALSE);
|
||||
Waiter->Irp->UserIosb->Status = FILE_PIPE_CONNECTED_STATE;
|
||||
Waiter->Irp->UserIosb->Information = 0;
|
||||
Waiter->Irp->IoStatus.Status = FILE_PIPE_CONNECTED_STATE;
|
||||
Waiter->Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Waiter->Irp, IO_NO_INCREMENT);
|
||||
|
||||
RemoveEntryList(&Waiter->Entry);
|
||||
|
@@ -20,8 +20,7 @@ VOID PortsStartup( PPORT_SET PortSet,
|
||||
RtlInitializeBitMap( &PortSet->ProtoBitmap,
|
||||
PortSet->ProtoBitBuffer,
|
||||
PortSet->PortsToOversee );
|
||||
RtlClearBits( &PortSet->ProtoBitmap,
|
||||
PortSet->StartingPort, PortsToManage );
|
||||
RtlClearAllBits( &PortSet->ProtoBitmap );
|
||||
ExInitializeFastMutex( &PortSet->Mutex );
|
||||
}
|
||||
|
||||
@@ -30,13 +29,17 @@ VOID PortsShutdown( PPORT_SET PortSet ) {
|
||||
}
|
||||
|
||||
VOID DeallocatePort( PPORT_SET PortSet, ULONG Port ) {
|
||||
RtlClearBits( &PortSet->ProtoBitmap,
|
||||
PortSet->StartingPort + Port, 1 );
|
||||
Port = htons(Port);
|
||||
ASSERT(Port >= PortSet->StartingPort);
|
||||
ASSERT(Port < PortSet->StartingPort + PortSet->PortsToOversee);
|
||||
RtlClearBits( &PortSet->ProtoBitmap, Port - PortSet->StartingPort, 1 );
|
||||
}
|
||||
|
||||
BOOLEAN AllocatePort( PPORT_SET PortSet, ULONG Port ) {
|
||||
BOOLEAN Clear;
|
||||
|
||||
Port = htons(Port);
|
||||
ASSERT(Port >= PortSet->StartingPort);
|
||||
Port -= PortSet->StartingPort;
|
||||
|
||||
ExAcquireFastMutex( &PortSet->Mutex );
|
||||
@@ -58,6 +61,8 @@ ULONG AllocateAnyPort( PPORT_SET PortSet ) {
|
||||
}
|
||||
ExReleaseFastMutex( &PortSet->Mutex );
|
||||
|
||||
AllocatedPort = htons(AllocatedPort);
|
||||
|
||||
return AllocatedPort;
|
||||
}
|
||||
|
||||
@@ -76,5 +81,7 @@ ULONG AllocatePortFromRange( PPORT_SET PortSet, ULONG Lowest, ULONG Highest ) {
|
||||
}
|
||||
ExReleaseFastMutex( &PortSet->Mutex );
|
||||
|
||||
AllocatedPort = htons(AllocatedPort);
|
||||
|
||||
return AllocatedPort;
|
||||
}
|
||||
|
@@ -109,16 +109,16 @@ VOID TCPAbortListenForSocket( PCONNECTION_ENDPOINT Listener,
|
||||
|
||||
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
|
||||
|
||||
for( ListEntry = Listener->ListenRequest.Flink;
|
||||
ListEntry != &Listener->ListenRequest;
|
||||
ListEntry = ListEntry->Flink ) {
|
||||
ListEntry = Listener->ListenRequest.Flink;
|
||||
while ( ListEntry != &Listener->ListenRequest ) {
|
||||
Bucket = CONTAINING_RECORD(ListEntry, TDI_BUCKET, Entry);
|
||||
ListEntry = ListEntry->Flink;
|
||||
|
||||
if( Bucket->Request.Handle.ConnectionContext == Connection ) {
|
||||
if( Bucket->AssociatedEndpoint == Connection ) {
|
||||
#ifdef MEMTRACK
|
||||
UntrackFL( __FILE__, __LINE__, Bucket->Request.RequestContext );
|
||||
#endif
|
||||
RemoveEntryList( ListEntry );
|
||||
RemoveEntryList( ListEntry->Blink );
|
||||
ExFreePool( Bucket );
|
||||
}
|
||||
}
|
||||
|
@@ -155,15 +155,28 @@ static VOID HandleSignalledConnection( PCONNECTION_ENDPOINT Connection,
|
||||
}
|
||||
|
||||
if( NewState & SEL_FIN ) {
|
||||
PLIST_ENTRY ListsToErase[4];
|
||||
NTSTATUS IrpStatus[4];
|
||||
UINT i;
|
||||
|
||||
TI_DbgPrint(DEBUG_TCP, ("EOF From socket\n"));
|
||||
|
||||
while( !IsListEmpty( &Connection->ReceiveRequest ) ) {
|
||||
Entry = RemoveHeadList( &Connection->ReceiveRequest );
|
||||
Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry );
|
||||
Complete = Bucket->Request.RequestNotifyObject;
|
||||
ListsToErase[0] = &Connection->ReceiveRequest;
|
||||
IrpStatus [0] = STATUS_SUCCESS;
|
||||
ListsToErase[1] = &Connection->ListenRequest;
|
||||
IrpStatus [1] = STATUS_UNSUCCESSFUL;
|
||||
ListsToErase[2] = &Connection->ConnectRequest;
|
||||
IrpStatus [2] = STATUS_UNSUCCESSFUL;
|
||||
ListsToErase[3] = 0;
|
||||
|
||||
Complete( Bucket->Request.RequestContext, STATUS_SUCCESS, 0 );
|
||||
}
|
||||
for( i = 0; ListsToErase[i]; i++ ) {
|
||||
while( !IsListEmpty( ListsToErase[i] ) ) {
|
||||
Entry = RemoveHeadList( ListsToErase[i] );
|
||||
Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry );
|
||||
Complete = Bucket->Request.RequestNotifyObject;
|
||||
Complete( Bucket->Request.RequestContext, STATUS_SUCCESS, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connection->Signalled = FALSE;
|
||||
@@ -371,39 +384,6 @@ NTSTATUS TCPTranslateError( int OskitError ) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
#if 0
|
||||
NTSTATUS TCPBind
|
||||
( PCONNECTION_ENDPOINT Connection,
|
||||
PTDI_CONNECTION_INFORMATION ConnInfo ) {
|
||||
NTSTATUS Status;
|
||||
SOCKADDR_IN AddressToConnect;
|
||||
PIP_ADDRESS LocalAddress;
|
||||
USHORT LocalPort;
|
||||
|
||||
TI_DbgPrint(DEBUG_TCP,("Called\n"));
|
||||
|
||||
Status = AddrBuildAddress
|
||||
((PTA_ADDRESS)ConnInfo->LocalAddress,
|
||||
&LocalAddress,
|
||||
&LocalPort);
|
||||
|
||||
AddressToBind.sin_family = AF_INET;
|
||||
memcpy( &AddressToBind.sin_addr,
|
||||
&LocalAddress->Address.IPv4Address,
|
||||
sizeof(AddressToBind.sin_addr) );
|
||||
AddressToBind.sin_port = LocalPort;
|
||||
|
||||
Status = OskitTCPBind( Connection->SocketContext,
|
||||
Connection,
|
||||
&AddressToBind,
|
||||
sizeof(AddressToBind));
|
||||
|
||||
TI_DbgPrint(DEBUG_TCP,("Leaving %x\n", Status));
|
||||
|
||||
return Status;
|
||||
}
|
||||
#endif
|
||||
|
||||
NTSTATUS TCPConnect
|
||||
( PCONNECTION_ENDPOINT Connection,
|
||||
PTDI_CONNECTION_INFORMATION ConnInfo,
|
||||
@@ -518,8 +498,9 @@ NTSTATUS TCPClose
|
||||
|
||||
Status = TCPTranslateError( OskitTCPClose( Connection->SocketContext ) );
|
||||
|
||||
if( Connection->Signalled )
|
||||
RemoveEntryList( &Connection->SignalList );
|
||||
/* Make our code remove all pending IRPs */
|
||||
Connection->State |= SEL_FIN;
|
||||
DrainSignals();
|
||||
|
||||
TcpipRecursiveMutexLeave( &TCPLock );
|
||||
|
||||
@@ -648,6 +629,8 @@ NTSTATUS TCPGetPeerAddress
|
||||
OSK_UI16 LocalPort, RemotePort;
|
||||
PTA_IP_ADDRESS AddressIP = (PTA_IP_ADDRESS)Address;
|
||||
|
||||
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
|
||||
|
||||
OskitTCPGetAddress
|
||||
( Connection->SocketContext,
|
||||
&LocalAddress, &LocalPort,
|
||||
@@ -658,6 +641,8 @@ NTSTATUS TCPGetPeerAddress
|
||||
AddressIP->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
|
||||
AddressIP->Address[0].Address[0].sin_port = RemotePort;
|
||||
AddressIP->Address[0].Address[0].in_addr = RemoteAddress;
|
||||
|
||||
TcpipRecursiveMutexLeave( &TCPLock );
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@@ -80,6 +80,11 @@ NTSTATUS DDKAPI ListenComplete
|
||||
PAFD_FCB FCB = (PAFD_FCB)Context;
|
||||
PAFD_TDI_OBJECT_QELT Qelt;
|
||||
|
||||
if ( Irp->Cancel ) {
|
||||
/* FIXME: is this anything else we need to do? */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if( !SocketAcquireStateLock( FCB ) ) return Status;
|
||||
|
||||
FCB->ListenIrp.InFlightRequest = NULL;
|
||||
|
@@ -136,7 +136,7 @@ typedef struct {
|
||||
} TDIEntityInfo;
|
||||
|
||||
#ifndef htons
|
||||
#define htons(x) (((x) << 16) | (((x) >> 8) & 0xff))
|
||||
#define htons(x) (((x) << 8) | (((x) >> 8) & 0xff))
|
||||
#endif
|
||||
|
||||
/* Global variable */
|
||||
|
@@ -219,6 +219,52 @@ VOID DDKAPI DispCancelRequest(
|
||||
}
|
||||
|
||||
|
||||
VOID DDKAPI DispCancelListenRequest(
|
||||
PDEVICE_OBJECT Device,
|
||||
PIRP Irp)
|
||||
/*
|
||||
* FUNCTION: Cancels a listen IRP
|
||||
* ARGUMENTS:
|
||||
* Device = Pointer to device object
|
||||
* Irp = Pointer to an I/O request packet
|
||||
*/
|
||||
{
|
||||
PIO_STACK_LOCATION IrpSp;
|
||||
PTRANSPORT_CONTEXT TranContext;
|
||||
PFILE_OBJECT FileObject;
|
||||
PCONNECTION_ENDPOINT Connection;
|
||||
/*NTSTATUS Status = STATUS_SUCCESS;*/
|
||||
|
||||
TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
|
||||
|
||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = IrpSp->FileObject;
|
||||
TranContext = (PTRANSPORT_CONTEXT)FileObject->FsContext;
|
||||
ASSERT( TDI_LISTEN == IrpSp->MinorFunction);
|
||||
|
||||
TI_DbgPrint(DEBUG_IRP, ("IRP at (0x%X).\n", Irp));
|
||||
|
||||
#ifdef DBG
|
||||
if (!Irp->Cancel)
|
||||
TI_DbgPrint(MIN_TRACE, ("Irp->Cancel is FALSE, should be TRUE.\n"));
|
||||
#endif
|
||||
|
||||
/* Try canceling the request */
|
||||
Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
|
||||
TCPAbortListenForSocket(
|
||||
Connection->AddressFile->Listener,
|
||||
Connection );
|
||||
|
||||
IoReleaseCancelSpinLock(Irp->CancelIrql);
|
||||
|
||||
DispDataRequestComplete(Irp, STATUS_CANCELLED, 0);
|
||||
|
||||
DispCancelComplete(FileObject);
|
||||
|
||||
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS DispTdiAccept(
|
||||
PIRP Irp)
|
||||
/*
|
||||
@@ -536,6 +582,12 @@ NTSTATUS DispTdiListen(
|
||||
Status = TCPListen( Connection->AddressFile->Listener, 1024 );
|
||||
/* BACKLOG */
|
||||
}
|
||||
if( NT_SUCCESS(Status) ) {
|
||||
Status = DispPrepareIrpForCancel
|
||||
(TranContext->Handle.ConnectionContext,
|
||||
Irp,
|
||||
(PDRIVER_CANCEL)DispCancelListenRequest);
|
||||
}
|
||||
|
||||
if( NT_SUCCESS(Status) ) {
|
||||
Status = TCPAccept
|
||||
|
@@ -58,7 +58,7 @@ static ULONG gNumberOfControllers = 0;
|
||||
|
||||
/* Queue thread management */
|
||||
static KEVENT QueueThreadTerminate;
|
||||
static PVOID ThreadObject;
|
||||
static PVOID QueueThreadObject;
|
||||
|
||||
|
||||
static VOID NTAPI MotorStopDpcFunc(PKDPC UnusedDpc,
|
||||
@@ -378,8 +378,8 @@ static VOID NTAPI Unload(PDRIVER_OBJECT DriverObject)
|
||||
KdPrint(("floppy: unloading\n"));
|
||||
|
||||
KeSetEvent(&QueueThreadTerminate, 0, FALSE);
|
||||
KeWaitForSingleObject(ThreadObject, Executive, KernelMode, FALSE, 0);
|
||||
ObDereferenceObject(ThreadObject);
|
||||
KeWaitForSingleObject(QueueThreadObject, Executive, KernelMode, FALSE, 0);
|
||||
ObDereferenceObject(QueueThreadObject);
|
||||
|
||||
for(i = 0; i < gNumberOfControllers; i++)
|
||||
{
|
||||
@@ -1152,7 +1152,7 @@ NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
if(ObReferenceObjectByHandle(ThreadHandle, STANDARD_RIGHTS_ALL, NULL, KernelMode, &ThreadObject, NULL) != STATUS_SUCCESS)
|
||||
if(ObReferenceObjectByHandle(ThreadHandle, STANDARD_RIGHTS_ALL, NULL, KernelMode, &QueueThreadObject, NULL) != STATUS_SUCCESS)
|
||||
{
|
||||
KdPrint(("floppy: Unable to reference returned thread handle; failing init\n"));
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
|
@@ -210,6 +210,7 @@ IntInitScreenInfo(
|
||||
pGdiInfo->ulLogPixelsX = pDevMode->dmLogPixels;
|
||||
pGdiInfo->ulLogPixelsY = pDevMode->dmLogPixels;
|
||||
pGdiInfo->flTextCaps = TC_RA_ABLE;
|
||||
pGdiInfo->flRaster = 0;
|
||||
pGdiInfo->ulDACRed = SelectedMode->NumberRedBits;
|
||||
pGdiInfo->ulDACGreen = SelectedMode->NumberGreenBits;
|
||||
pGdiInfo->ulDACBlue = SelectedMode->NumberBlueBits;
|
||||
|
@@ -77,6 +77,27 @@ enum
|
||||
#define HIGH_LEVEL 31 // Highest interrupt level
|
||||
#define SYNCH_LEVEL (IPI_LEVEL-1) // synchronization level
|
||||
|
||||
#define WINSTA_ACCESSCLIPBOARD (0x4L)
|
||||
#define WINSTA_ACCESSGLOBALATOMS (0x20L)
|
||||
#define WINSTA_CREATEDESKTOP (0x8L)
|
||||
#define WINSTA_ENUMDESKTOPS (0x1L)
|
||||
#define WINSTA_ENUMERATE (0x100L)
|
||||
#define WINSTA_EXITWINDOWS (0x40L)
|
||||
#define WINSTA_READATTRIBUTES (0x2L)
|
||||
#define WINSTA_READSCREEN (0x200L)
|
||||
#define WINSTA_WRITEATTRIBUTES (0x10L)
|
||||
|
||||
#define DF_ALLOWOTHERACCOUNTHOOK (0x1L)
|
||||
#define DESKTOP_CREATEMENU (0x4L)
|
||||
#define DESKTOP_CREATEWINDOW (0x2L)
|
||||
#define DESKTOP_ENUMERATE (0x40L)
|
||||
#define DESKTOP_HOOKCONTROL (0x8L)
|
||||
#define DESKTOP_JOURNALPLAYBACK (0x20L)
|
||||
#define DESKTOP_JOURNALRECORD (0x10L)
|
||||
#define DESKTOP_READOBJECTS (0x1L)
|
||||
#define DESKTOP_SWITCHDESKTOP (0x100L)
|
||||
#define DESKTOP_WRITEOBJECTS (0x80L)
|
||||
|
||||
#endif /* __ASM__ */
|
||||
|
||||
/* Values returned by KeGetPreviousMode() */
|
||||
|
@@ -30,6 +30,22 @@ typedef enum _WORK_QUEUE_TYPE {
|
||||
MaximumWorkQueue
|
||||
} WORK_QUEUE_TYPE;
|
||||
|
||||
typedef struct _EX_QUEUE_WORKER_INFO {
|
||||
UCHAR QueueDisabled:1;
|
||||
UCHAR MakeThreadsAsNecessary:1;
|
||||
UCHAR WaitMode:1;
|
||||
ULONG WorkerCount:29;
|
||||
} EX_QUEUE_WORKER_INFO, *PEX_QUEUE_WORKER_INFO;
|
||||
|
||||
typedef struct _EX_WORK_QUEUE {
|
||||
KQUEUE WorkerQueue;
|
||||
ULONG DynamicThreadCount;
|
||||
ULONG WorkItemsProcessed;
|
||||
ULONG WorkItemsProcessedLastPass;
|
||||
ULONG QueueDepthLastPass;
|
||||
EX_QUEUE_WORKER_INFO Info;
|
||||
} EX_WORK_QUEUE, *PEX_WORK_QUEUE;
|
||||
|
||||
typedef ULONG_PTR ERESOURCE_THREAD, *PERESOURCE_THREAD;
|
||||
|
||||
typedef struct _OWNER_ENTRY
|
||||
|
@@ -886,6 +886,8 @@ struct _FAST_IO_DISPATCH_TABLE
|
||||
#endif
|
||||
|
||||
#define IO_TYPE_DRIVER 4L
|
||||
#define IO_TYPE_FILE 0x0F5L
|
||||
|
||||
#define DRVO_UNLOAD_INVOKED 0x1L
|
||||
#define DRVO_LEGACY_DRIVER 0x2L
|
||||
#define DRVO_BUILTIN_DRIVER 0x4L
|
||||
|
@@ -42,6 +42,15 @@ VOID STDCALL KeAcquireSpinLock (PKSPIN_LOCK SpinLock,
|
||||
|
||||
#ifndef __USE_W32API
|
||||
|
||||
static __inline
|
||||
VOID
|
||||
KeMemoryBarrier(
|
||||
VOID)
|
||||
{
|
||||
volatile LONG Barrier;
|
||||
__asm__ __volatile__ ("xchg %%eax, %0" : : "m" (Barrier) : "%eax");
|
||||
}
|
||||
|
||||
VOID STDCALL KeAcquireSpinLockAtDpcLevel (IN PKSPIN_LOCK SpinLock);
|
||||
|
||||
#define KefAcquireSpinLockAtDpcLevel KeAcquireSpinLockAtDpcLevel
|
||||
@@ -720,7 +729,7 @@ KeCapturePersistentThreadState(
|
||||
BOOLEAN
|
||||
STDCALL
|
||||
KeRemoveSystemServiceTable(
|
||||
IN PUCHAR Number
|
||||
IN ULONG TableIndex
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
|
@@ -36,23 +36,34 @@ typedef VOID STDCALL_FUNC
|
||||
|
||||
struct _DISPATCHER_HEADER;
|
||||
|
||||
typedef enum _KERNEL_OBJECTS {
|
||||
KNotificationEvent = 0,
|
||||
KSynchronizationEvent = 1,
|
||||
KMutant = 2,
|
||||
KProcess = 3,
|
||||
KQueue = 4,
|
||||
KSemaphore = 5,
|
||||
KThread = 6,
|
||||
KNotificationTimer = 8,
|
||||
KSynchronizationTimer = 9,
|
||||
KApc = 18,
|
||||
KDpc = 19,
|
||||
KDeviceQueue = 20,
|
||||
KEventPair = 21,
|
||||
KInterrupt = 22,
|
||||
KProfile = 23
|
||||
} KERNEL_OBJECTS;
|
||||
typedef enum _KOBJECTS {
|
||||
EventNotificationObject = 0,
|
||||
EventSynchronizationObject = 1,
|
||||
MutantObject = 2,
|
||||
ProcessObject = 3,
|
||||
QueueObject = 4,
|
||||
SemaphoreObject = 5,
|
||||
ThreadObject = 6,
|
||||
GateObject = 7,
|
||||
TimerNotificationObject = 8,
|
||||
TimerSynchronizationObject = 9,
|
||||
Spare2Object = 10,
|
||||
Spare3Object = 11,
|
||||
Spare4Object = 12,
|
||||
Spare5Object = 13,
|
||||
Spare6Object = 14,
|
||||
Spare7Object = 15,
|
||||
Spare8Object = 16,
|
||||
Spare9Object = 17,
|
||||
ApcObject = 18,
|
||||
DpcObject = 19,
|
||||
DeviceQueueObject = 20,
|
||||
EventPairObject = 21,
|
||||
InterruptObject = 22,
|
||||
ProfileObject = 23,
|
||||
ThreadedDpcObject = 24,
|
||||
MaximumKernelObject = 25
|
||||
} KOBJECTS;
|
||||
|
||||
#include <pshpack1.h>
|
||||
|
||||
|
@@ -14,12 +14,12 @@ LdrFindResource_U(IN PVOID BaseAddress,
|
||||
IN ULONG Level,
|
||||
OUT PIMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry);
|
||||
|
||||
/*NTSTATUS STDCALL
|
||||
NTSTATUS STDCALL
|
||||
LdrFindResourceDirectory_U( IN PVOID BaseAddress,
|
||||
IN PLDR_RESOURCE_INFO ResourceInfo,
|
||||
IN PLDR_RESOURCE_INFO ResourceInfo,
|
||||
IN ULONG Level,
|
||||
OUT PIMAGE_RESOURCE_DIRECTORY *ResourceDirectory);
|
||||
*/
|
||||
|
||||
NTSTATUS STDCALL
|
||||
LdrEnumResources(IN PVOID BaseAddress,
|
||||
IN PLDR_RESOURCE_INFO ResourceInfo,
|
||||
|
@@ -360,7 +360,7 @@ STDCALL PsSetThreadWin32Thread(
|
||||
VOID STDCALL
|
||||
STDCALL PsEstablishWin32Callouts (PW32_PROCESS_CALLBACK W32ProcessCallback,
|
||||
PW32_THREAD_CALLBACK W32ThreadCallback,
|
||||
PVOID Param3,
|
||||
PW32_OBJECT_CALLBACK W32ObjectCallback,
|
||||
PVOID Param4,
|
||||
ULONG W32ThreadSize,
|
||||
ULONG W32ProcessSize);
|
||||
|
@@ -66,6 +66,40 @@ typedef NTSTATUS STDCALL_FUNC
|
||||
typedef NTSTATUS STDCALL_FUNC
|
||||
(*PW32_THREAD_CALLBACK)(struct _ETHREAD *Thread,
|
||||
BOOLEAN Create);
|
||||
|
||||
/*
|
||||
* Callbacks used for Win32 objects... this define won't be needed after the Object Manager
|
||||
* rewrite -- Alex
|
||||
*/
|
||||
typedef NTSTATUS STDCALL_FUNC
|
||||
(*OBJECT_CREATE_ROUTINE)(PVOID ObjectBody,
|
||||
PVOID Parent,
|
||||
PWSTR RemainingPath,
|
||||
struct _OBJECT_ATTRIBUTES* ObjectAttributes);
|
||||
|
||||
typedef NTSTATUS STDCALL_FUNC
|
||||
(*OBJECT_PARSE_ROUTINE)(PVOID Object,
|
||||
PVOID *NextObject,
|
||||
PUNICODE_STRING FullPath,
|
||||
PWSTR *Path,
|
||||
ULONG Attributes);
|
||||
|
||||
typedef VOID STDCALL_FUNC
|
||||
(*OBJECT_DELETE_ROUTINE)(PVOID DeletedObject);
|
||||
|
||||
typedef PVOID STDCALL_FUNC
|
||||
(*OBJECT_FIND_ROUTINE)(PVOID WinStaObject,
|
||||
PWSTR Name,
|
||||
ULONG Attributes);
|
||||
|
||||
typedef struct _W32_OBJECT_CALLBACK {
|
||||
OBJECT_CREATE_ROUTINE WinStaCreate;
|
||||
OBJECT_PARSE_ROUTINE WinStaParse;
|
||||
OBJECT_DELETE_ROUTINE WinStaDelete;
|
||||
OBJECT_FIND_ROUTINE WinStaFind;
|
||||
OBJECT_CREATE_ROUTINE DesktopCreate;
|
||||
OBJECT_DELETE_ROUTINE DesktopDelete;
|
||||
} W32_OBJECT_CALLBACK, *PW32_OBJECT_CALLBACK;
|
||||
|
||||
typedef struct _STACK_INFORMATION
|
||||
{
|
||||
|
@@ -98,37 +98,36 @@ typedef struct _SEP_AUDIT_POLICY {
|
||||
} SEP_AUDIT_POLICY, *PSEP_AUDIT_POLICY;
|
||||
|
||||
typedef struct _TOKEN {
|
||||
TOKEN_SOURCE TokenSource; /* 0x00 */
|
||||
LUID TokenId; /* 0x10 */
|
||||
LUID AuthenticationId; /* 0x18 */
|
||||
LUID ParentTokenId; /* 0x20 */
|
||||
LARGE_INTEGER ExpirationTime; /* 0x28 */
|
||||
struct _ERESOURCE *TokenLock; /* 0x30 */
|
||||
ULONG Padding; /* 0x34 */
|
||||
SEP_AUDIT_POLICY AuditPolicy; /* 0x38 */
|
||||
LUID ModifiedId; /* 0x40 */
|
||||
ULONG SessionId; /* 0x48 */
|
||||
ULONG UserAndGroupCount; /* 0x4C */
|
||||
ULONG RestrictedSidCount; /* 0x50 */
|
||||
ULONG PrivilegeCount; /* 0x54 */
|
||||
ULONG VariableLength; /* 0x58 */
|
||||
ULONG DynamicCharged; /* 0x5C */
|
||||
ULONG DynamicAvailable; /* 0x60 */
|
||||
ULONG DefaultOwnerIndex; /* 0x64 */
|
||||
PSID_AND_ATTRIBUTES UserAndGroups; /* 0x68 */
|
||||
PSID_AND_ATTRIBUTES RestrictedSids; /* 0x6C */
|
||||
PSID PrimaryGroup; /* 0x70 */
|
||||
PLUID_AND_ATTRIBUTES Privileges; /* 0x74 */
|
||||
PULONG DynamicPart; /* 0x78 */
|
||||
PACL DefaultDacl; /* 0x7C */
|
||||
TOKEN_TYPE TokenType; /* 0x80 */
|
||||
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; /* 0x84 */
|
||||
ULONG TokenFlags; /* 0x88 */
|
||||
ULONG TokenInUse; /* 0x8C */
|
||||
PVOID ProxyData; /* 0x90 */
|
||||
PVOID AuditData; /* 0x94 */
|
||||
LUID OriginatingLogonSession; /* 0x98 */
|
||||
UCHAR VariablePart[1]; /* 0xA0 */
|
||||
TOKEN_SOURCE TokenSource; /* 0x00 */
|
||||
LUID TokenId; /* 0x10 */
|
||||
LUID AuthenticationId; /* 0x18 */
|
||||
LUID ParentTokenId; /* 0x20 */
|
||||
LARGE_INTEGER ExpirationTime; /* 0x28 */
|
||||
struct _ERESOURCE *TokenLock; /* 0x30 */
|
||||
SEP_AUDIT_POLICY AuditPolicy; /* 0x38 */
|
||||
LUID ModifiedId; /* 0x40 */
|
||||
ULONG SessionId; /* 0x48 */
|
||||
ULONG UserAndGroupCount; /* 0x4C */
|
||||
ULONG RestrictedSidCount; /* 0x50 */
|
||||
ULONG PrivilegeCount; /* 0x54 */
|
||||
ULONG VariableLength; /* 0x58 */
|
||||
ULONG DynamicCharged; /* 0x5C */
|
||||
ULONG DynamicAvailable; /* 0x60 */
|
||||
ULONG DefaultOwnerIndex; /* 0x64 */
|
||||
PSID_AND_ATTRIBUTES UserAndGroups; /* 0x68 */
|
||||
PSID_AND_ATTRIBUTES RestrictedSids; /* 0x6C */
|
||||
PSID PrimaryGroup; /* 0x70 */
|
||||
PLUID_AND_ATTRIBUTES Privileges; /* 0x74 */
|
||||
PULONG DynamicPart; /* 0x78 */
|
||||
PACL DefaultDacl; /* 0x7C */
|
||||
TOKEN_TYPE TokenType; /* 0x80 */
|
||||
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; /* 0x84 */
|
||||
ULONG TokenFlags; /* 0x88 */
|
||||
BOOLEAN TokenInUse; /* 0x8C */
|
||||
PVOID ProxyData; /* 0x90 */
|
||||
PVOID AuditData; /* 0x94 */
|
||||
LUID OriginatingLogonSession; /* 0x98 */
|
||||
ULONG VariablePart; /* 0xA0 */
|
||||
} TOKEN, *PTOKEN;
|
||||
|
||||
typedef PVOID PACCESS_TOKEN;
|
||||
|
@@ -25,6 +25,26 @@
|
||||
extern "C" {
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
||||
#ifndef __DDRAW_GUID_DEFINED__
|
||||
DEFINE_GUID( CLSID_DirectDraw, 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 );
|
||||
DEFINE_GUID( CLSID_DirectDraw7, 0x3C305196,0x50DB,0x11D3,0x9C,0xFE,0x00,0xC0,0x4F,0xD9,0x30,0xC5 );
|
||||
DEFINE_GUID( CLSID_DirectDrawClipper, 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 );
|
||||
DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
|
||||
DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 );
|
||||
DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 );
|
||||
DEFINE_GUID( IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b );
|
||||
DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
|
||||
DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 );
|
||||
DEFINE_GUID( IID_IDirectDrawSurface3, 0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB );
|
||||
DEFINE_GUID( IID_IDirectDrawSurface4, 0x0B2B8630,0xAD35,0x11D0,0x8E,0xA6,0x00,0x60,0x97,0x97,0xEA,0x5B );
|
||||
DEFINE_GUID( IID_IDirectDrawSurface7, 0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b );
|
||||
DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
|
||||
DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
|
||||
DEFINE_GUID( IID_IDirectDrawColorControl,0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8 );
|
||||
DEFINE_GUID( IID_IDirectDrawGammaControl,0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00,0xC0,0x4F,0xC2,0x9B,0x4E );
|
||||
|
||||
#endif
|
||||
|
||||
#define DDENUMRET_CANCEL 0
|
||||
#define DDENUMRET_OK 1
|
||||
|
||||
|
@@ -770,6 +770,13 @@ NTSTATUS
|
||||
STDCALL
|
||||
RtlDeleteTimerQueue(HANDLE TimerQueue);
|
||||
|
||||
PVOID
|
||||
STDCALL
|
||||
RtlEncodePointer(IN PVOID Pointer);
|
||||
|
||||
PVOID
|
||||
STDCALL
|
||||
RtlDecodePointer(IN PVOID Pointer);
|
||||
|
||||
#ifndef __NTDRIVER__
|
||||
|
||||
|
@@ -87,12 +87,38 @@ typedef struct _OBJECT_ATTRIBUTES
|
||||
PVOID SecurityQualityOfService;
|
||||
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
|
||||
|
||||
typedef struct _HANDLE_TABLE_ENTRY_INFO {
|
||||
ULONG AuditMask;
|
||||
} HANDLE_TABLE_ENTRY_INFO, *PHANDLE_TABLE_ENTRY_INFO;
|
||||
|
||||
typedef struct _HANDLE_TABLE_ENTRY {
|
||||
union {
|
||||
PVOID Object;
|
||||
ULONG_PTR ObAttributes;
|
||||
PHANDLE_TABLE_ENTRY_INFO InfoTable;
|
||||
ULONG_PTR Value;
|
||||
} u1;
|
||||
union {
|
||||
ULONG GrantedAccess;
|
||||
USHORT GrantedAccessIndex;
|
||||
LONG NextFreeTableEntry;
|
||||
} u2;
|
||||
} HANDLE_TABLE_ENTRY, *PHANDLE_TABLE_ENTRY;
|
||||
|
||||
#endif /* __USE_W32API */
|
||||
|
||||
typedef struct _HANDLE_TABLE
|
||||
{
|
||||
LIST_ENTRY ListHead;
|
||||
KSPIN_LOCK ListLock;
|
||||
ULONG Flags;
|
||||
LONG HandleCount;
|
||||
PHANDLE_TABLE_ENTRY **Table;
|
||||
PEPROCESS QuotaProcess;
|
||||
HANDLE UniqueProcessId;
|
||||
LONG FirstFreeTableEntry;
|
||||
LONG NextIndexNeedingPool;
|
||||
ERESOURCE HandleTableLock;
|
||||
LIST_ENTRY HandleTableList;
|
||||
KEVENT HandleContentionEvent;
|
||||
} HANDLE_TABLE;
|
||||
|
||||
#ifndef __USE_W32API
|
||||
|
@@ -153,13 +153,14 @@ typedef struct _SECURITY_DESCRIPTOR_CONTEXT
|
||||
#define TOKEN_ADJUST_PRIVILEGES (0x0020L)
|
||||
#define TOKEN_ADJUST_GROUPS (0x0040L)
|
||||
#define TOKEN_ADJUST_DEFAULT (0x0080L)
|
||||
#define TOKEN_ADJUST_SESSIONID (0x0100L)
|
||||
|
||||
#define TOKEN_ALL_ACCESS (0xf00ffL)
|
||||
#define TOKEN_ALL_ACCESS (0xf01ffL)
|
||||
#define TOKEN_READ (0x20008L)
|
||||
#define TOKEN_WRITE (0x200e0L)
|
||||
#define TOKEN_EXECUTE (0x20000L)
|
||||
|
||||
typedef BOOL SECURITY_CONTEXT_TRACKING_MODE;
|
||||
typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE, *PSECURITY_CONTEXT_TRACKING_MODE;
|
||||
|
||||
#define SECURITY_STATIC_TRACKING (0)
|
||||
#define SECURITY_DYNAMIC_TRACKING (1)
|
||||
@@ -192,12 +193,13 @@ typedef enum _TOKEN_INFORMATION_CLASS
|
||||
TokenOrigin
|
||||
} TOKEN_INFORMATION_CLASS;
|
||||
|
||||
typedef ULONG SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
|
||||
|
||||
#define SecurityAnonymous ((SECURITY_IMPERSONATION_LEVEL)0)
|
||||
#define SecurityIdentification ((SECURITY_IMPERSONATION_LEVEL)1)
|
||||
#define SecurityImpersonation ((SECURITY_IMPERSONATION_LEVEL)2)
|
||||
#define SecurityDelegation ((SECURITY_IMPERSONATION_LEVEL)3)
|
||||
typedef enum _SECURITY_IMPERSONATION_LEVEL
|
||||
{
|
||||
SecurityAnonymous,
|
||||
SecurityIdentification,
|
||||
SecurityImpersonation,
|
||||
SecurityDelegation
|
||||
} SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
|
||||
|
||||
typedef ULONG ACCESS_MASK, *PACCESS_MASK;
|
||||
typedef ULONG TOKEN_TYPE, *PTOKEN_TYPE;
|
||||
@@ -339,6 +341,20 @@ typedef struct _TOKEN_GROUPS
|
||||
SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
|
||||
} TOKEN_GROUPS, *PTOKEN_GROUPS, *LPTOKEN_GROUPS;
|
||||
|
||||
typedef struct _TOKEN_GROUPS_AND_PRIVILEGES
|
||||
{
|
||||
ULONG SidCount;
|
||||
ULONG SidLength;
|
||||
PSID_AND_ATTRIBUTES Sids;
|
||||
ULONG RestrictedSidCount;
|
||||
ULONG RestrictedSidLength;
|
||||
PSID_AND_ATTRIBUTES RestrictedSids;
|
||||
ULONG PrivilegeCount;
|
||||
ULONG PrivilegeLength;
|
||||
PLUID_AND_ATTRIBUTES Privileges;
|
||||
LUID AuthenticationId;
|
||||
} TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES;
|
||||
|
||||
typedef struct _TOKEN_PRIVILEGES
|
||||
{
|
||||
DWORD PrivilegeCount;
|
||||
|
@@ -492,6 +492,7 @@ typedef struct _ADDRESS_RANGE
|
||||
#define MB_FLAGS_BOOT_LOADER_NAME (0x200)
|
||||
#define MB_FLAGS_APM_TABLE (0x400)
|
||||
#define MB_FLAGS_GRAPHICS_TABLE (0x800)
|
||||
#define MB_FLAGS_ACPI_TABLE (0x1000)
|
||||
|
||||
typedef struct _LOADER_MODULE
|
||||
{
|
||||
|
@@ -58,6 +58,7 @@ typedef enum _KPROFILE_SOURCE
|
||||
ProfileTime
|
||||
} KPROFILE_SOURCE;
|
||||
|
||||
|
||||
// file disposition values
|
||||
|
||||
#define FILE_SUPERSEDE 0x0000
|
||||
@@ -489,6 +490,19 @@ struct _SYSTEM_CACHE_INFORMATION
|
||||
|
||||
} SYSTEM_CACHE_INFORMATION;
|
||||
|
||||
// SystemInterruptInformation (23)
|
||||
typedef
|
||||
struct _SYSTEM_INTERRUPT_INFORMATION
|
||||
{
|
||||
ULONG ContextSwitches;
|
||||
ULONG DpcCount;
|
||||
ULONG DpcRate;
|
||||
ULONG TimeIncrement;
|
||||
ULONG DpcBypassCount;
|
||||
ULONG ApcBypassCount;
|
||||
|
||||
} SYSTEM_INTERRUPT_INFORMATION, *PSYSTEM_INTERRUPT_INFORMATION;
|
||||
|
||||
// SystemDpcInformation (24)
|
||||
typedef
|
||||
struct _SYSTEM_DPC_INFORMATION
|
||||
@@ -1219,9 +1233,17 @@ extern IMPORTED ULONG NtBuildNumber;
|
||||
#define ProcessSessionInformation 24
|
||||
#define ProcessForegroundInformation 25
|
||||
#define ProcessWow64Information 26
|
||||
/* ReactOS private. */
|
||||
#define ProcessImageFileName 27
|
||||
#define MaxProcessInfoClass 28
|
||||
#define ProcessLUIDDeviceMapsEnabled 28
|
||||
#define ProcessBreakOnTermination 29
|
||||
#define ProcessDebugObjectHandle 30
|
||||
#define ProcessDebugFlags 31
|
||||
#define ProcessHandleTracing 32
|
||||
#define ProcessUnknown33 33
|
||||
#define ProcessUnknown34 34
|
||||
#define ProcessUnknown35 35
|
||||
#define ProcessCookie 36
|
||||
#define MaxProcessInfoClass 36
|
||||
|
||||
/*
|
||||
* thread query / set information class
|
||||
@@ -1263,9 +1285,9 @@ typedef enum _MUTANT_INFORMATION_CLASS
|
||||
|
||||
typedef struct _MUTANT_BASIC_INFORMATION
|
||||
{
|
||||
LONG Count;
|
||||
BOOLEAN Owned;
|
||||
BOOLEAN Abandoned;
|
||||
LONG CurrentCount;
|
||||
BOOLEAN OwnedByCaller;
|
||||
BOOLEAN AbandonedState;
|
||||
} MUTANT_BASIC_INFORMATION, *PMUTANT_BASIC_INFORMATION;
|
||||
|
||||
|
||||
|
@@ -18,11 +18,11 @@
|
||||
#define __VERSION_H
|
||||
|
||||
#define KERNEL_VERSION_MAJOR 0
|
||||
#define KERNEL_VERSION_MINOR 3
|
||||
#define KERNEL_VERSION_PATCH_LEVEL 0
|
||||
#define KERNEL_VERSION_MINOR 2
|
||||
#define KERNEL_VERSION_PATCH_LEVEL 6
|
||||
|
||||
/* KERNEL_VERSION_BUILD_TYPE is L"SVN", L"RC1", L"RC2" or L"RELEASE" */
|
||||
#define KERNEL_VERSION_BUILD_TYPE L"SVN"
|
||||
#define KERNEL_VERSION_BUILD_TYPE L"RELEASE"
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -3,21 +3,31 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* smdll/connect.c */
|
||||
/* smlib/connect.c */
|
||||
NTSTATUS STDCALL
|
||||
SmConnectApiPort (IN PUNICODE_STRING pSbApiPortName OPTIONAL,
|
||||
IN HANDLE hSbApiPort OPTIONAL,
|
||||
IN DWORD dwSubsystem OPTIONAL, /* pe.h */
|
||||
IN OUT PHANDLE phSmApiPort);
|
||||
/* smdll/compses.c */
|
||||
/* smlib/compses.c */
|
||||
NTSTATUS STDCALL
|
||||
SmCompleteSession (IN HANDLE hSmApiPort,
|
||||
IN HANDLE hSbApiPort,
|
||||
IN HANDLE hApiPort);
|
||||
/* smdll/execpgm.c */
|
||||
/* smlib/execpgm.c */
|
||||
NTSTATUS STDCALL
|
||||
SmExecuteProgram (IN HANDLE hSmApiPort,
|
||||
IN PUNICODE_STRING Pgm
|
||||
);
|
||||
/* smdll/query.c */
|
||||
typedef enum {
|
||||
SM_BASE_INFORMATION
|
||||
} SM_INFORMATION_CLASS, *PSM_INFORMATION_CLASS;
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SmQuery (IN HANDLE SmApiPort,
|
||||
IN SM_INFORMATION_CLASS SmInformationClass,
|
||||
IN OUT PVOID Data,
|
||||
IN OUT PULONG DataLength);
|
||||
|
||||
#endif /* ndef INCLUDE_SM_HELPER_H */
|
||||
|
@@ -103,6 +103,11 @@ NtUserBuildPropList(
|
||||
DWORD BufferSize,
|
||||
DWORD *Count);
|
||||
|
||||
enum {
|
||||
HWND_ROUTINE_REGISTERSHELLHOOKWINDOW,
|
||||
HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW
|
||||
};
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserCallHwnd(
|
||||
|
@@ -1,5 +1,4 @@
|
||||
/* $Id $
|
||||
*
|
||||
/*
|
||||
* Compatibility header
|
||||
*
|
||||
* This header is wrapper to allow compilation of Wine DLLs under ReactOS
|
||||
@@ -59,6 +58,18 @@ typedef LPFINDINFOW LPLVFINDINFOW;
|
||||
#define HDM_SETBITMAPMARGIN (HDM_FIRST+20)
|
||||
#define HDM_GETBITMAPMARGIN (HDM_FIRST+21)
|
||||
|
||||
#define FLATSB_CLASSA "flatsb_class32"
|
||||
#define SB_SETBORDERS (WM_USER+5)
|
||||
|
||||
#define FLATSB_CLASSA "flatsb_class32"
|
||||
#define DRAGLISTMSGSTRINGA "commctrl_DragListMsg"
|
||||
#if defined(__GNUC__)
|
||||
# define DRAGLISTMSGSTRINGW (const WCHAR []){ 'c','o','m','m','c','t','r','l', \
|
||||
'_','D','r','a','g','L','i','s','t','M','s','g',0 }
|
||||
#elif defined(_MSC_VER)
|
||||
# define DRAGLISTMSGSTRINGW L"commctrl_DragListMsg"
|
||||
#else
|
||||
static const WCHAR DRAGLISTMSGSTRINGW[] = { 'c','o','m','m','c','t','r','l', \
|
||||
'_','D','r','a','g','L','i','s','t','M','s','g',0 };
|
||||
#endif
|
||||
|
||||
#endif /* __WINE_COMMCTRL_H */
|
||||
|
@@ -89,6 +89,20 @@ enum msidbFeatureAttributes
|
||||
msidbFeatureAttributesNoUnsupportedAdvertise = 0x00000020
|
||||
};
|
||||
|
||||
enum msidbComponentAttributes
|
||||
{
|
||||
msidbComponentAttributesLocalOnly = 0x00000000,
|
||||
msidbComponentAttributesSourceOnly = 0x00000001,
|
||||
msidbComponentAttributesOptional = 0x00000002,
|
||||
msidbComponentAttributesRegistryKeyPath = 0x00000004,
|
||||
msidbComponentAttributesSharedDllRefCount = 0x00000008,
|
||||
msidbComponentAttributesPermanent = 0x00000010,
|
||||
msidbComponentAttributesODBCDataSource = 0x00000020,
|
||||
msidbComponentAttributesTransitive = 0x00000040,
|
||||
msidbComponentAttributesNeverOverwrite = 0x00000080,
|
||||
msidbComponentAttributes64bit = 0x00000100
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
40
reactos/include/wine/richole.h
Normal file
40
reactos/include/wine/richole.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Compatibility header
|
||||
*
|
||||
* This header is wrapper to allow compilation of Wine DLLs under ReactOS
|
||||
* build system. It contains definitions commonly refered to as Wineisms
|
||||
* and definitions that are missing in w32api.
|
||||
*/
|
||||
|
||||
#include <richedit.h>
|
||||
|
||||
#include_next <richole.h>
|
||||
|
||||
#ifndef WINE_RICHOLE_H_INCLUDED
|
||||
#define WINE_RICHOLE_H_INCLUDED
|
||||
|
||||
#ifdef COBJMACROS
|
||||
/*** IUnknown methods ***/
|
||||
#define IRichEditOle_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||
#define IRichEditOle_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define IRichEditOle_Release(p) (p)->lpVtbl->Release(p)
|
||||
/*** IRichEditOle methods ***/
|
||||
#define IRichEditOle_GetClientSite(p,a) (p)->lpVtbl->GetClientSite(p,a)
|
||||
#define IRichEditOle_GetObjectCount(p) (p)->lpVtbl->GetObjectCount(p)
|
||||
#define IRichEditOle_GetLinkCount(p) (p)->lpVtbl->GetLinkCount(p)
|
||||
#define IRichEditOle_GetObject(p,a,b,c) (p)->lpVtbl->GetObject(p,a,b,c)
|
||||
#define IRichEditOle_InsertObject(p,a) (p)->lpVtbl->InsertObject(p,a)
|
||||
#define IRichEditOle_ConvertObject(p,a,b,c) (p)->lpVtbl->ConvertObject(p,a,b,c)
|
||||
#define IRichEditOle_ActivateAs(p,a,b) (p)->lpVtbl->ActivateAs(p,a,b)
|
||||
#define IRichEditOle_SetHostNames(p,a,b) (p)->lpVtbl->SetHostNames(p,a,b)
|
||||
#define IRichEditOle_SetLinkAvailable(p,a,b) (p)->lpVtbl->SetLinkAvailable(p,a,b)
|
||||
#define IRichEditOle_SetDvaspect(p,a,b) (p)->lpVtbl->SetDvaspect(p,a,b)
|
||||
#define IRichEditOle_HandsOffStorage(p,a) (p)->lpVtbl->HandsOffStorage(p,a)
|
||||
#define IRichEditOle_SaveCompleted(p,a,b) (p)->lpVtbl->SaveCompleted(p,a,b)
|
||||
#define IRichEditOle_InPlaceDeactivate(p) (p)->lpVtbl->InPlaceDeactivate(p)
|
||||
#define IRichEditOle_ContextSensitiveHelp(p,a) (p)->lpVtbl->ContextSensitiveHelp(p,a)
|
||||
#define IRichEditOle_GetClipboardData(p,a,b,c) (p)->lpVtbl->GetClipboardData(p,a,b,c)
|
||||
#define IRichEditOle_ImportDataObject(p,a,b,c) (p)->lpVtbl->ImportDataObject(p,a,b,c)
|
||||
#endif
|
||||
|
||||
#endif /* WINE_RICHOLE_H_INCLUDED */
|
@@ -10,4 +10,4 @@
|
||||
IDB_USRGRPIMAGES BITMAP "res/usrgrp.bmp"
|
||||
|
||||
#include "aclui_En.rc"
|
||||
|
||||
#include "aclui_De.rc"
|
||||
|
23
reactos/lib/aclui/aclui_De.rc
Normal file
23
reactos/lib/aclui/aclui_De.rc
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <reactos/resource.h>
|
||||
#include <defines.h>
|
||||
#include "resource.h"
|
||||
|
||||
LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT
|
||||
|
||||
IDD_SECPAGE DIALOGEX 0, 0, 227, 215
|
||||
STYLE WS_CHILD | WS_VISIBLE | WS_CAPTION
|
||||
CAPTION "Sicherheit"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "&Gruppen oder Benutzernamen:", -1, 7, 7, 105, 8
|
||||
CONTROL "", IDC_ACELIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 7, 17, 213, 66, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
|
||||
PUSHBUTTON "&Hinzuf<75>gen...", IDC_ACELIST_ADD, 116, 87, 50, 14
|
||||
PUSHBUTTON "&Entfernen", IDC_ACELIST_REMOVE, 170, 87, 50, 14
|
||||
LTEXT "Erlauben", -1, 135, 107, 32, 8, SS_CENTER
|
||||
LTEXT "Verbieten", -1, 176, 107, 32, 8, SS_CENTER
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
{
|
||||
IDS_PSP_TITLE "Berechtigungen f<>r %1"
|
||||
}
|
@@ -250,7 +250,7 @@ LsaNtStatusToWinError@4
|
||||
LsaOpenPolicy@16
|
||||
;LsaOpenSecret@16
|
||||
;LsaOpenTrustedDomain@16
|
||||
;LsaQueryInfoTrustedDomain
|
||||
LsaQueryInfoTrustedDomain@12
|
||||
LsaQueryInformationPolicy@12
|
||||
;LsaQuerySecret@20
|
||||
;LsaQuerySecurityObject@12
|
||||
|
@@ -507,4 +507,19 @@ LsaGetUserName(
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
LsaQueryInfoTrustedDomain (DWORD Unknonw0,
|
||||
DWORD Unknonw1,
|
||||
DWORD Unknonw2)
|
||||
{
|
||||
DPRINT1("LsaQueryInfoTrustedDomain not implemented\n");
|
||||
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
575
reactos/lib/advapi32/winetests/crypt.c
Normal file
575
reactos/lib/advapi32/winetests/crypt.c
Normal file
@@ -0,0 +1,575 @@
|
||||
/*
|
||||
* Unit tests for crypt functions
|
||||
*
|
||||
* Copyright (c) 2004 Michael Jung
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wincrypt.h"
|
||||
#include "winerror.h"
|
||||
#include "winreg.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static const char szRsaBaseProv[] = MS_DEF_PROV_A;
|
||||
static const char szNonExistentProv[] = "Wine Nonexistent Cryptographic Provider v11.2";
|
||||
static const char szKeySet[] = "wine_test_keyset";
|
||||
static const char szBadKeySet[] = "wine_test_bad_keyset";
|
||||
#define NON_DEF_PROV_TYPE 999
|
||||
|
||||
static HMODULE hadvapi32;
|
||||
static BOOL (WINAPI *pCryptAcquireContextA)(HCRYPTPROV*,LPCSTR,LPCSTR,DWORD,DWORD);
|
||||
static BOOL (WINAPI *pCryptEnumProviderTypesA)(DWORD, DWORD*, DWORD, DWORD*, LPSTR, DWORD*);
|
||||
static BOOL (WINAPI *pCryptEnumProvidersA)(DWORD, DWORD*, DWORD, DWORD*, LPSTR, DWORD*);
|
||||
static BOOL (WINAPI *pCryptGetDefaultProviderA)(DWORD, DWORD*, DWORD, LPSTR, DWORD*);
|
||||
static BOOL (WINAPI *pCryptReleaseContext)(HCRYPTPROV, DWORD);
|
||||
static BOOL (WINAPI *pCryptSetProviderExA)(LPCSTR, DWORD, DWORD*, DWORD);
|
||||
|
||||
static void init_function_pointers(void)
|
||||
{
|
||||
hadvapi32 = GetModuleHandleA("advapi32.dll");
|
||||
|
||||
if(hadvapi32)
|
||||
{
|
||||
pCryptAcquireContextA = (void*)GetProcAddress(hadvapi32, "CryptAcquireContextA");
|
||||
pCryptEnumProviderTypesA = (void*)GetProcAddress(hadvapi32, "CryptEnumProviderTypesA");
|
||||
pCryptEnumProvidersA = (void*)GetProcAddress(hadvapi32, "CryptEnumProvidersA");
|
||||
pCryptGetDefaultProviderA = (void*)GetProcAddress(hadvapi32, "CryptGetDefaultProviderA");
|
||||
pCryptReleaseContext = (void*)GetProcAddress(hadvapi32, "CryptReleaseContext");
|
||||
pCryptSetProviderExA = (void*)GetProcAddress(hadvapi32, "CryptSetProviderExA");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void init_environment(void)
|
||||
{
|
||||
HCRYPTPROV hProv;
|
||||
|
||||
/* Ensure that container "wine_test_keyset" does exist */
|
||||
if (!pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0))
|
||||
{
|
||||
pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_NEWKEYSET);
|
||||
}
|
||||
pCryptReleaseContext(hProv, 0);
|
||||
|
||||
/* Ensure that container "wine_test_keyset" does exist in default PROV_RSA_FULL type provider */
|
||||
if (!pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, 0))
|
||||
{
|
||||
pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET);
|
||||
}
|
||||
pCryptReleaseContext(hProv, 0);
|
||||
|
||||
/* Ensure that container "wine_test_bad_keyset" does not exist. */
|
||||
if (pCryptAcquireContextA(&hProv, szBadKeySet, szRsaBaseProv, PROV_RSA_FULL, 0))
|
||||
{
|
||||
pCryptReleaseContext(hProv, 0);
|
||||
pCryptAcquireContextA(&hProv, szBadKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_DELETEKEYSET);
|
||||
}
|
||||
}
|
||||
|
||||
static void clean_up_environment(void)
|
||||
{
|
||||
HCRYPTPROV hProv;
|
||||
|
||||
/* Remove container "wine_test_keyset" */
|
||||
if (pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0))
|
||||
{
|
||||
pCryptReleaseContext(hProv, 0);
|
||||
pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_DELETEKEYSET);
|
||||
}
|
||||
|
||||
/* Remove container "wine_test_keyset" from default PROV_RSA_FULL type provider */
|
||||
if (pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, 0))
|
||||
{
|
||||
pCryptReleaseContext(hProv, 0);
|
||||
pCryptAcquireContextA(&hProv, szKeySet, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_acquire_context(void)
|
||||
{
|
||||
BOOL result;
|
||||
HCRYPTPROV hProv;
|
||||
|
||||
/* Provoke all kinds of error conditions (which are easy to provoke).
|
||||
* The order of the error tests seems to match Windows XP's rsaenh.dll CSP,
|
||||
* but since this is likely to change between CSP versions, we don't check
|
||||
* this. Please don't change the order of tests. */
|
||||
result = pCryptAcquireContextA(&hProv, NULL, NULL, 0, 0);
|
||||
ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%ld\n", GetLastError());
|
||||
|
||||
result = pCryptAcquireContextA(&hProv, NULL, NULL, 1000, 0);
|
||||
ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%ld\n", GetLastError());
|
||||
|
||||
result = pCryptAcquireContextA(&hProv, NULL, NULL, NON_DEF_PROV_TYPE, 0);
|
||||
ok(!result && GetLastError()==NTE_PROV_TYPE_NOT_DEF, "%ld\n", GetLastError());
|
||||
|
||||
result = pCryptAcquireContextA(&hProv, szKeySet, szNonExistentProv, PROV_RSA_FULL, 0);
|
||||
ok(!result && GetLastError()==NTE_KEYSET_NOT_DEF, "%ld\n", GetLastError());
|
||||
|
||||
result = pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, NON_DEF_PROV_TYPE, 0);
|
||||
ok(!result && GetLastError()==NTE_PROV_TYPE_NO_MATCH, "%ld\n", GetLastError());
|
||||
|
||||
/* This test fails under Win2k SP4:
|
||||
result = TRUE, GetLastError() == ERROR_INVALID_PARAMETER
|
||||
SetLastError(0xdeadbeef);
|
||||
result = pCryptAcquireContextA(NULL, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0);
|
||||
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%d/%ld\n", result, GetLastError());
|
||||
*/
|
||||
|
||||
/* Last not least, try to really acquire a context. */
|
||||
hProv = 0;
|
||||
SetLastError(0xdeadbeef);
|
||||
result = pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0);
|
||||
ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE), "%d/%ld\n", result, GetLastError());
|
||||
|
||||
if (hProv)
|
||||
pCryptReleaseContext(hProv, 0);
|
||||
|
||||
/* Try again, witch an empty ("\0") szProvider parameter */
|
||||
hProv = 0;
|
||||
SetLastError(0xdeadbeef);
|
||||
result = pCryptAcquireContextA(&hProv, szKeySet, "", PROV_RSA_FULL, 0);
|
||||
ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE), "%d/%ld\n", result, GetLastError());
|
||||
|
||||
if (hProv)
|
||||
pCryptReleaseContext(hProv, 0);
|
||||
}
|
||||
|
||||
static BOOL FindProvRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszProvName,
|
||||
DWORD *pcbProvName, DWORD *pdwProvCount)
|
||||
{
|
||||
HKEY hKey;
|
||||
HKEY subkey;
|
||||
DWORD size = sizeof(DWORD);
|
||||
|
||||
if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\Defaults\\Provider", &hKey))
|
||||
return FALSE;
|
||||
|
||||
RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwProvCount, pcbProvName,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
(*pcbProvName)++;
|
||||
|
||||
if (!(*pszProvName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbProvName))))
|
||||
return FALSE;
|
||||
|
||||
RegEnumKeyEx(hKey, dwIndex, *pszProvName, pcbProvName, NULL, NULL, NULL, NULL);
|
||||
(*pcbProvName)++;
|
||||
|
||||
RegOpenKey(hKey, *pszProvName, &subkey);
|
||||
RegQueryValueEx(subkey, "Type", NULL, NULL, (BYTE*)pdwProvType, &size);
|
||||
|
||||
RegCloseKey(subkey);
|
||||
RegCloseKey(hKey);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void test_enum_providers(void)
|
||||
{
|
||||
/* expected results */
|
||||
CHAR *pszProvName = NULL;
|
||||
DWORD cbName;
|
||||
DWORD dwType;
|
||||
DWORD provCount;
|
||||
DWORD dwIndex = 0;
|
||||
|
||||
/* actual results */
|
||||
CHAR *provider = NULL;
|
||||
DWORD providerLen;
|
||||
DWORD type;
|
||||
DWORD count;
|
||||
BOOL result;
|
||||
DWORD notNull = 5;
|
||||
DWORD notZeroFlags = 5;
|
||||
|
||||
if(!pCryptEnumProvidersA)
|
||||
{
|
||||
trace("skipping CryptEnumProviders tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FindProvRegVals(dwIndex, &dwType, &pszProvName, &cbName, &provCount))
|
||||
return;
|
||||
|
||||
/* check pdwReserved flag for NULL */
|
||||
result = pCryptEnumProvidersA(dwIndex, ¬Null, 0, &type, NULL, &providerLen);
|
||||
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
|
||||
|
||||
/* check dwFlags == 0 */
|
||||
result = pCryptEnumProvidersA(dwIndex, NULL, notZeroFlags, &type, NULL, &providerLen);
|
||||
ok(!result && GetLastError()==NTE_BAD_FLAGS, "%ld\n", GetLastError());
|
||||
|
||||
/* alloc provider to half the size required
|
||||
* cbName holds the size required */
|
||||
providerLen = cbName / 2;
|
||||
if (!(provider = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, providerLen))))
|
||||
return;
|
||||
|
||||
result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, provider, &providerLen);
|
||||
ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %ld\n",
|
||||
ERROR_MORE_DATA, GetLastError());
|
||||
|
||||
LocalFree(provider);
|
||||
|
||||
/* loop through the providers to get the number of providers
|
||||
* after loop ends, count should be provCount + 1 so subtract 1
|
||||
* to get actual number of providers */
|
||||
count = 0;
|
||||
while(pCryptEnumProvidersA(count++, NULL, 0, &type, NULL, &providerLen))
|
||||
;
|
||||
count--;
|
||||
ok(count==provCount, "expected %i, got %i\n", (int)provCount, (int)count);
|
||||
|
||||
/* loop past the actual number of providers to get the error
|
||||
* ERROR_NO_MORE_ITEMS */
|
||||
for (count = 0; count < provCount + 1; count++)
|
||||
result = pCryptEnumProvidersA(count, NULL, 0, &type, NULL, &providerLen);
|
||||
ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n",
|
||||
ERROR_NO_MORE_ITEMS, GetLastError());
|
||||
|
||||
/* check expected versus actual values returned */
|
||||
result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, NULL, &providerLen);
|
||||
ok(result && providerLen==cbName, "expected %i, got %i\n", (int)cbName, (int)providerLen);
|
||||
if (!(provider = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, providerLen))))
|
||||
return;
|
||||
|
||||
result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, provider, &providerLen);
|
||||
ok(result && type==dwType, "expected %ld, got %ld\n",
|
||||
dwType, type);
|
||||
ok(result && !strcmp(pszProvName, provider), "expected %s, got %s\n", pszProvName, provider);
|
||||
ok(result && cbName==providerLen, "expected %ld, got %ld\n",
|
||||
cbName, providerLen);
|
||||
|
||||
LocalFree(provider);
|
||||
}
|
||||
|
||||
static BOOL FindProvTypesRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszTypeName,
|
||||
DWORD *pcbTypeName, DWORD *pdwTypeCount)
|
||||
{
|
||||
HKEY hKey;
|
||||
HKEY hSubKey;
|
||||
PSTR ch;
|
||||
|
||||
if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\Defaults\\Provider Types", &hKey))
|
||||
return FALSE;
|
||||
|
||||
if (RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwTypeCount, pcbTypeName, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL))
|
||||
return FALSE;
|
||||
(*pcbTypeName)++;
|
||||
|
||||
if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName))))
|
||||
return FALSE;
|
||||
|
||||
if (RegEnumKeyEx(hKey, dwIndex, *pszTypeName, pcbTypeName, NULL, NULL, NULL, NULL))
|
||||
return FALSE;
|
||||
(*pcbTypeName)++;
|
||||
ch = *pszTypeName + strlen(*pszTypeName);
|
||||
/* Convert "Type 000" to 0, etc/ */
|
||||
*pdwProvType = *(--ch) - '0';
|
||||
*pdwProvType += (*(--ch) - '0') * 10;
|
||||
*pdwProvType += (*(--ch) - '0') * 100;
|
||||
|
||||
if (RegOpenKey(hKey, *pszTypeName, &hSubKey))
|
||||
return FALSE;
|
||||
|
||||
if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, NULL, pcbTypeName))
|
||||
return FALSE;
|
||||
|
||||
if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName))))
|
||||
return FALSE;
|
||||
|
||||
if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, *pszTypeName, pcbTypeName))
|
||||
return FALSE;
|
||||
|
||||
RegCloseKey(hSubKey);
|
||||
RegCloseKey(hKey);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void test_enum_provider_types()
|
||||
{
|
||||
/* expected values */
|
||||
DWORD dwProvType;
|
||||
LPSTR pszTypeName = NULL;
|
||||
DWORD cbTypeName;
|
||||
DWORD dwTypeCount;
|
||||
|
||||
/* actual values */
|
||||
DWORD index = 0;
|
||||
DWORD provType;
|
||||
LPSTR typeName = NULL;
|
||||
DWORD typeNameSize;
|
||||
DWORD typeCount;
|
||||
DWORD result;
|
||||
DWORD notNull = 5;
|
||||
DWORD notZeroFlags = 5;
|
||||
|
||||
if(!pCryptEnumProviderTypesA)
|
||||
{
|
||||
trace("skipping CryptEnumProviderTypes tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FindProvTypesRegVals(index, &dwProvType, &pszTypeName, &cbTypeName, &dwTypeCount))
|
||||
{
|
||||
trace("could not find provider types in registry, skipping the test\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* check pdwReserved for NULL */
|
||||
result = pCryptEnumProviderTypesA(index, ¬Null, 0, &provType, typeName, &typeNameSize);
|
||||
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n",
|
||||
ERROR_INVALID_PARAMETER, GetLastError());
|
||||
|
||||
/* check dwFlags == zero */
|
||||
result = pCryptEnumProviderTypesA(index, NULL, notZeroFlags, &provType, typeName, &typeNameSize);
|
||||
ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %i, got %ld\n",
|
||||
ERROR_INVALID_PARAMETER, GetLastError());
|
||||
|
||||
/* alloc provider type to half the size required
|
||||
* cbTypeName holds the size required */
|
||||
typeNameSize = cbTypeName / 2;
|
||||
if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize))))
|
||||
return;
|
||||
|
||||
/* This test fails under Win2k SP4:
|
||||
result = TRUE, GetLastError() == 0xdeadbeef
|
||||
SetLastError(0xdeadbeef);
|
||||
result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize);
|
||||
ok(!result && GetLastError()==ERROR_MORE_DATA, "expected 0/ERROR_MORE_DATA, got %d/%08lx\n",
|
||||
result, GetLastError());
|
||||
*/
|
||||
|
||||
LocalFree(typeName);
|
||||
|
||||
/* loop through the provider types to get the number of provider types
|
||||
* after loop ends, count should be dwTypeCount + 1 so subtract 1
|
||||
* to get actual number of provider types */
|
||||
typeCount = 0;
|
||||
while(pCryptEnumProviderTypesA(typeCount++, NULL, 0, &provType, NULL, &typeNameSize))
|
||||
;
|
||||
typeCount--;
|
||||
ok(typeCount==dwTypeCount, "expected %ld, got %ld\n", dwTypeCount, typeCount);
|
||||
|
||||
/* loop past the actual number of provider types to get the error
|
||||
* ERROR_NO_MORE_ITEMS */
|
||||
for (typeCount = 0; typeCount < dwTypeCount + 1; typeCount++)
|
||||
result = pCryptEnumProviderTypesA(typeCount, NULL, 0, &provType, NULL, &typeNameSize);
|
||||
ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n",
|
||||
ERROR_NO_MORE_ITEMS, GetLastError());
|
||||
|
||||
|
||||
/* check expected versus actual values returned */
|
||||
result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, NULL, &typeNameSize);
|
||||
ok(result && typeNameSize==cbTypeName, "expected %ld, got %ld\n", cbTypeName, typeNameSize);
|
||||
if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize))))
|
||||
return;
|
||||
|
||||
typeNameSize = 0xdeadbeef;
|
||||
result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize);
|
||||
ok(result, "expected TRUE, got %ld\n", result);
|
||||
ok(provType==dwProvType, "expected %ld, got %ld\n", dwProvType, provType);
|
||||
if (pszTypeName)
|
||||
ok(!strcmp(pszTypeName, typeName), "expected %s, got %s\n", pszTypeName, typeName);
|
||||
ok(typeNameSize==cbTypeName, "expected %ld, got %ld\n", cbTypeName, typeNameSize);
|
||||
|
||||
LocalFree(typeName);
|
||||
}
|
||||
|
||||
static BOOL FindDfltProvRegVals(DWORD dwProvType, DWORD dwFlags, LPSTR *pszProvName, DWORD *pcbProvName)
|
||||
{
|
||||
HKEY hKey;
|
||||
PSTR keyname;
|
||||
PSTR ptr;
|
||||
DWORD user = dwFlags & CRYPT_USER_DEFAULT;
|
||||
|
||||
LPSTR MACHINESTR = "Software\\Microsoft\\Cryptography\\Defaults\\Provider Types\\Type XXX";
|
||||
LPSTR USERSTR = "Software\\Microsoft\\Cryptography\\Provider Type XXX";
|
||||
|
||||
keyname = LocalAlloc(LMEM_ZEROINIT, (user ? strlen(USERSTR) : strlen(MACHINESTR)) + 1);
|
||||
if (keyname)
|
||||
{
|
||||
user ? strcpy(keyname, USERSTR) : strcpy(keyname, MACHINESTR);
|
||||
ptr = keyname + strlen(keyname);
|
||||
*(--ptr) = (dwProvType % 10) + '0';
|
||||
*(--ptr) = ((dwProvType / 10) % 10) + '0';
|
||||
*(--ptr) = (dwProvType / 100) + '0';
|
||||
} else
|
||||
return FALSE;
|
||||
|
||||
if (RegOpenKey((dwFlags & CRYPT_USER_DEFAULT) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE ,keyname, &hKey))
|
||||
{
|
||||
LocalFree(keyname);
|
||||
return FALSE;
|
||||
}
|
||||
LocalFree(keyname);
|
||||
|
||||
if (RegQueryValueEx(hKey, "Name", NULL, NULL, *pszProvName, pcbProvName))
|
||||
{
|
||||
if (GetLastError() != ERROR_MORE_DATA)
|
||||
SetLastError(NTE_PROV_TYPE_ENTRY_BAD);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(*pszProvName = LocalAlloc(LMEM_ZEROINIT, *pcbProvName)))
|
||||
return FALSE;
|
||||
|
||||
if (RegQueryValueEx(hKey, "Name", NULL, NULL, *pszProvName, pcbProvName))
|
||||
{
|
||||
if (GetLastError() != ERROR_MORE_DATA)
|
||||
SetLastError(NTE_PROV_TYPE_ENTRY_BAD);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void test_get_default_provider()
|
||||
{
|
||||
/* expected results */
|
||||
DWORD dwProvType = PROV_RSA_FULL;
|
||||
DWORD dwFlags = CRYPT_MACHINE_DEFAULT;
|
||||
LPSTR pszProvName = NULL;
|
||||
DWORD cbProvName;
|
||||
|
||||
/* actual results */
|
||||
DWORD provType = PROV_RSA_FULL;
|
||||
DWORD flags = CRYPT_MACHINE_DEFAULT;
|
||||
LPSTR provName = NULL;
|
||||
DWORD provNameSize;
|
||||
DWORD result;
|
||||
DWORD notNull = 5;
|
||||
|
||||
if(!pCryptGetDefaultProviderA)
|
||||
{
|
||||
trace("skipping CryptGetDefaultProvider tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
FindDfltProvRegVals(dwProvType, dwFlags, &pszProvName, &cbProvName);
|
||||
|
||||
/* check pdwReserved for NULL */
|
||||
result = pCryptGetDefaultProviderA(provType, ¬Null, flags, provName, &provNameSize);
|
||||
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n",
|
||||
ERROR_INVALID_PARAMETER, GetLastError());
|
||||
|
||||
/* check for invalid flag */
|
||||
flags = 0xdeadbeef;
|
||||
result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize);
|
||||
ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %ld, got %ld\n",
|
||||
NTE_BAD_FLAGS, GetLastError());
|
||||
flags = CRYPT_MACHINE_DEFAULT;
|
||||
|
||||
/* check for invalid prov type */
|
||||
provType = 0xdeadbeef;
|
||||
result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize);
|
||||
ok(!result && (GetLastError() == NTE_BAD_PROV_TYPE ||
|
||||
GetLastError() == ERROR_INVALID_PARAMETER),
|
||||
"expected NTE_BAD_PROV_TYPE or ERROR_INVALID_PARAMETER, got %ld/%ld\n",
|
||||
result, GetLastError());
|
||||
provType = PROV_RSA_FULL;
|
||||
|
||||
SetLastError(0);
|
||||
|
||||
/* alloc provName to half the size required
|
||||
* cbProvName holds the size required */
|
||||
provNameSize = cbProvName / 2;
|
||||
if (!(provName = LocalAlloc(LMEM_ZEROINIT, provNameSize)))
|
||||
return;
|
||||
|
||||
result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize);
|
||||
ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %ld\n",
|
||||
ERROR_MORE_DATA, GetLastError());
|
||||
|
||||
LocalFree(provName);
|
||||
|
||||
/* check expected versus actual values returned */
|
||||
result = pCryptGetDefaultProviderA(provType, NULL, flags, NULL, &provNameSize);
|
||||
ok(result && provNameSize==cbProvName, "expected %ld, got %ld\n", cbProvName, provNameSize);
|
||||
provNameSize = cbProvName;
|
||||
|
||||
if (!(provName = LocalAlloc(LMEM_ZEROINIT, provNameSize)))
|
||||
return;
|
||||
|
||||
result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize);
|
||||
ok(result && !strcmp(pszProvName, provName), "expected %s, got %s\n", pszProvName, provName);
|
||||
ok(result && provNameSize==cbProvName, "expected %ld, got %ld\n", cbProvName, provNameSize);
|
||||
|
||||
LocalFree(provName);
|
||||
}
|
||||
|
||||
static void test_set_provider_ex()
|
||||
{
|
||||
DWORD result;
|
||||
DWORD notNull = 5;
|
||||
|
||||
/* results */
|
||||
LPSTR pszProvName = NULL;
|
||||
DWORD cbProvName;
|
||||
|
||||
if(!pCryptGetDefaultProviderA || !pCryptSetProviderExA)
|
||||
{
|
||||
trace("skipping CryptSetProviderEx tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* check pdwReserved for NULL */
|
||||
result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, ¬Null, CRYPT_MACHINE_DEFAULT);
|
||||
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n",
|
||||
ERROR_INVALID_PARAMETER, GetLastError());
|
||||
|
||||
/* remove the default provider and then set it to MS_DEF_PROV/PROV_RSA_FULL */
|
||||
result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT | CRYPT_DELETE_DEFAULT);
|
||||
ok(result, "%ld\n", GetLastError());
|
||||
|
||||
result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT);
|
||||
ok(result, "%ld\n", GetLastError());
|
||||
|
||||
/* call CryptGetDefaultProvider to see if they match */
|
||||
result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, NULL, &cbProvName);
|
||||
if (!(pszProvName = LocalAlloc(LMEM_ZEROINIT, cbProvName)))
|
||||
return;
|
||||
|
||||
result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, pszProvName, &cbProvName);
|
||||
ok(result && !strcmp(MS_DEF_PROV, pszProvName), "expected %s, got %s\n", MS_DEF_PROV, pszProvName);
|
||||
ok(result && cbProvName==(strlen(MS_DEF_PROV) + 1), "expected %i, got %ld\n", (strlen(MS_DEF_PROV) + 1), cbProvName);
|
||||
|
||||
LocalFree(pszProvName);
|
||||
}
|
||||
|
||||
START_TEST(crypt)
|
||||
{
|
||||
init_function_pointers();
|
||||
if(pCryptAcquireContextA && pCryptReleaseContext) {
|
||||
init_environment();
|
||||
test_acquire_context();
|
||||
clean_up_environment();
|
||||
}
|
||||
|
||||
test_enum_providers();
|
||||
test_enum_provider_types();
|
||||
test_get_default_provider();
|
||||
test_set_provider_ex();
|
||||
}
|
63
reactos/lib/advapi32/winetests/crypt_lmhash.c
Normal file
63
reactos/lib/advapi32/winetests/crypt_lmhash.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Unit tests for SystemFunction006 (LMHash?)
|
||||
*
|
||||
* Copyright 2004 Hans Leidekker
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
typedef VOID (WINAPI *fnSystemFunction006)( PCSTR passwd, PSTR lmhash );
|
||||
fnSystemFunction006 pSystemFunction006;
|
||||
|
||||
static void test_SystemFunction006()
|
||||
{
|
||||
static unsigned char lmhash[16 + 1];
|
||||
|
||||
unsigned char passwd[] = { 's','e','c','r','e','t', 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
unsigned char expect[] =
|
||||
{ 0x85, 0xf5, 0x28, 0x9f, 0x09, 0xdc, 0xa7, 0xeb,
|
||||
0xaa, 0xd3, 0xb4, 0x35, 0xb5, 0x14, 0x04, 0xee };
|
||||
|
||||
pSystemFunction006( passwd, lmhash );
|
||||
|
||||
ok( !memcmp( lmhash, expect, sizeof(expect) ),
|
||||
"lmhash: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
||||
lmhash[0], lmhash[1], lmhash[2], lmhash[3], lmhash[4], lmhash[5],
|
||||
lmhash[6], lmhash[7], lmhash[8], lmhash[9], lmhash[10], lmhash[11],
|
||||
lmhash[12], lmhash[13], lmhash[14], lmhash[15] );
|
||||
}
|
||||
|
||||
START_TEST(crypt_lmhash)
|
||||
{
|
||||
HMODULE module;
|
||||
|
||||
if (!(module = LoadLibrary("advapi32.dll"))) return;
|
||||
|
||||
pSystemFunction006 = (fnSystemFunction006)GetProcAddress( module, "SystemFunction006" );
|
||||
|
||||
if (!pSystemFunction006) goto out;
|
||||
|
||||
if (pSystemFunction006)
|
||||
test_SystemFunction006();
|
||||
|
||||
out:
|
||||
FreeLibrary( module );
|
||||
}
|
109
reactos/lib/advapi32/winetests/crypt_md4.c
Normal file
109
reactos/lib/advapi32/winetests/crypt_md4.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Unit tests for MD4 functions
|
||||
*
|
||||
* Copyright 2004 Hans Leidekker
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int buf[4];
|
||||
unsigned int i[2];
|
||||
unsigned char in[64];
|
||||
unsigned char digest[16];
|
||||
} MD4_CTX;
|
||||
|
||||
typedef VOID (WINAPI *fnMD4Init)( MD4_CTX *ctx );
|
||||
typedef VOID (WINAPI *fnMD4Update)( MD4_CTX *ctx, const unsigned char *src, const int len );
|
||||
typedef VOID (WINAPI *fnMD4Final)( MD4_CTX *ctx );
|
||||
|
||||
fnMD4Init pMD4Init;
|
||||
fnMD4Update pMD4Update;
|
||||
fnMD4Final pMD4Final;
|
||||
|
||||
#define ctxcmp( a, b ) memcmp( (char*)a, (char*)b, FIELD_OFFSET( MD4_CTX, in ) )
|
||||
|
||||
void test_md4_ctx()
|
||||
{
|
||||
static unsigned char message[] =
|
||||
"In our Life there's If"
|
||||
"In our beliefs there's Lie"
|
||||
"In our business there is Sin"
|
||||
"In our bodies, there is Die";
|
||||
|
||||
int size = strlen( message );
|
||||
HMODULE module;
|
||||
|
||||
MD4_CTX ctx;
|
||||
MD4_CTX ctx_initialized =
|
||||
{
|
||||
{ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
MD4_CTX ctx_update1 =
|
||||
{
|
||||
{ 0x5e592ef7, 0xbdcb1567, 0x2b626d17, 0x7d1198bd },
|
||||
{ 0x00000338, 0 }
|
||||
};
|
||||
|
||||
MD4_CTX ctx_update2 =
|
||||
{
|
||||
{ 0x05dcfd65, 0xb3711c0d, 0x9e3369c2, 0x903ead11 },
|
||||
{ 0x00000670, 0 }
|
||||
};
|
||||
|
||||
unsigned char expect[16] =
|
||||
{ 0x5f, 0xd3, 0x9b, 0x29, 0x47, 0x53, 0x47, 0xaf,
|
||||
0xa5, 0xba, 0x0c, 0x05, 0xff, 0xc0, 0xc7, 0xda };
|
||||
|
||||
if (!(module = LoadLibrary( "advapi32.dll" ))) return;
|
||||
|
||||
pMD4Init = (fnMD4Init)GetProcAddress( module, "MD4Init" );
|
||||
pMD4Update = (fnMD4Update)GetProcAddress( module, "MD4Update" );
|
||||
pMD4Final = (fnMD4Final)GetProcAddress( module, "MD4Final" );
|
||||
|
||||
if (!pMD4Init || !pMD4Update || !pMD4Final) goto out;
|
||||
|
||||
memset( &ctx, 0, sizeof(ctx) );
|
||||
pMD4Init( &ctx );
|
||||
ok( !ctxcmp( &ctx, &ctx_initialized ), "invalid initialization\n" );
|
||||
|
||||
pMD4Update( &ctx, message, size );
|
||||
ok( !ctxcmp( &ctx, &ctx_update1 ), "update doesn't work correctly\n" );
|
||||
|
||||
pMD4Update( &ctx, message, size );
|
||||
ok( !ctxcmp( &ctx, &ctx_update2 ), "update doesn't work correctly\n" );
|
||||
|
||||
pMD4Final( &ctx );
|
||||
ok( ctxcmp( &ctx, &ctx_initialized ), "context has changed\n" );
|
||||
ok( !memcmp( ctx.digest, expect, sizeof(expect) ), "incorrect result\n" );
|
||||
|
||||
out:
|
||||
FreeLibrary( module );
|
||||
}
|
||||
|
||||
START_TEST(crypt_md4)
|
||||
{
|
||||
test_md4_ctx();
|
||||
}
|
109
reactos/lib/advapi32/winetests/crypt_md5.c
Normal file
109
reactos/lib/advapi32/winetests/crypt_md5.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Unit tests for MD5 functions
|
||||
*
|
||||
* Copyright 2004 Hans Leidekker
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int i[2];
|
||||
unsigned int buf[4];
|
||||
unsigned char in[64];
|
||||
unsigned char digest[16];
|
||||
} MD5_CTX;
|
||||
|
||||
typedef VOID (WINAPI *fnMD5Init)( MD5_CTX *ctx );
|
||||
typedef VOID (WINAPI *fnMD5Update)( MD5_CTX *ctx, const unsigned char *src, const int len );
|
||||
typedef VOID (WINAPI *fnMD5Final)( MD5_CTX *ctx );
|
||||
|
||||
fnMD5Init pMD5Init;
|
||||
fnMD5Update pMD5Update;
|
||||
fnMD5Final pMD5Final;
|
||||
|
||||
#define ctxcmp( a, b ) memcmp( (char*)a, (char*)b, FIELD_OFFSET( MD5_CTX, in ) )
|
||||
|
||||
void test_md5_ctx()
|
||||
{
|
||||
static unsigned char message[] =
|
||||
"In our Life there's If"
|
||||
"In our beliefs there's Lie"
|
||||
"In our business there is Sin"
|
||||
"In our bodies, there is Die";
|
||||
|
||||
int size = strlen( message );
|
||||
HMODULE module;
|
||||
|
||||
MD5_CTX ctx;
|
||||
MD5_CTX ctx_initialized =
|
||||
{
|
||||
{ 0, 0 },
|
||||
{ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }
|
||||
};
|
||||
|
||||
MD5_CTX ctx_update1 =
|
||||
{
|
||||
{ 0x00000338, 0 },
|
||||
{ 0x068cb64d, 0xb7a05790, 0x426979ee, 0xed67e221 }
|
||||
};
|
||||
|
||||
MD5_CTX ctx_update2 =
|
||||
{
|
||||
{ 0x00000670, 0 },
|
||||
{ 0x2f7afe58, 0xcc3e9315, 0x709c465c, 0xbf6414c8 }
|
||||
};
|
||||
|
||||
unsigned char expect[16] =
|
||||
{ 0x43, 0x03, 0xdd, 0x8c, 0x60, 0xd9, 0x3a, 0x22,
|
||||
0x0b, 0x28, 0xd0, 0xb2, 0x65, 0x93, 0xd0, 0x36 };
|
||||
|
||||
if (!(module = LoadLibrary( "advapi32.dll" ))) return;
|
||||
|
||||
pMD5Init = (fnMD5Init)GetProcAddress( module, "MD5Init" );
|
||||
pMD5Update = (fnMD5Update)GetProcAddress( module, "MD5Update" );
|
||||
pMD5Final = (fnMD5Final)GetProcAddress( module, "MD5Final" );
|
||||
|
||||
if (!pMD5Init || !pMD5Update || !pMD5Final) goto out;
|
||||
|
||||
memset( &ctx, 0, sizeof(ctx) );
|
||||
pMD5Init( &ctx );
|
||||
ok( !ctxcmp( &ctx, &ctx_initialized ), "invalid initialization\n" );
|
||||
|
||||
pMD5Update( &ctx, message, size );
|
||||
ok( !ctxcmp( &ctx, &ctx_update1 ), "update doesn't work correctly\n" );
|
||||
|
||||
pMD5Update( &ctx, message, size );
|
||||
ok( !ctxcmp( &ctx, &ctx_update2 ), "update doesn't work correctly\n" );
|
||||
|
||||
pMD5Final( &ctx );
|
||||
ok( ctxcmp( &ctx, &ctx_initialized ), "context has changed\n" );
|
||||
ok( !memcmp( ctx.digest, expect, sizeof(expect) ), "incorrect result\n" );
|
||||
|
||||
out:
|
||||
FreeLibrary( module );
|
||||
}
|
||||
|
||||
START_TEST(crypt_md5)
|
||||
{
|
||||
test_md5_ctx();
|
||||
}
|
81
reactos/lib/advapi32/winetests/crypt_sha.c
Normal file
81
reactos/lib/advapi32/winetests/crypt_sha.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Unit tests for SHA functions
|
||||
*
|
||||
* Copyright (c) 2004 Filip Navara
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
typedef struct {
|
||||
ULONG Unknown[6];
|
||||
ULONG State[5];
|
||||
ULONG Count[2];
|
||||
UCHAR Buffer[64];
|
||||
} SHA_CTX, *PSHA_CTX;
|
||||
|
||||
#define ctxcmp(a,b) memcmp((char*)a, (char*)b, FIELD_OFFSET(SHA_CTX, Buffer))
|
||||
|
||||
static void test_sha_ctx(void)
|
||||
{
|
||||
FARPROC pA_SHAInit, pA_SHAUpdate, pA_SHAFinal;
|
||||
static const char test_buffer[] = "In our Life there's If"
|
||||
"In our beliefs there's Lie"
|
||||
"In our business there is Sin"
|
||||
"In our bodies, there is Die";
|
||||
ULONG test_buffer_size = strlen(test_buffer);
|
||||
HMODULE hmod;
|
||||
SHA_CTX ctx;
|
||||
SHA_CTX ctx_initialized = {{0, 0, 0, 0, 0}, {0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0}, {0, 0}};
|
||||
SHA_CTX ctx_update1 = {{0, 0, 0, 0, 0}, {0xdbe5eba8, 0x6b4335ca, 0xf7c94abe, 0xc9f34e31, 0x311023f0}, {0, 0x67}};
|
||||
SHA_CTX ctx_update2 = {{0, 0, 0, 0, 0}, {0x5ecc818d, 0x52498169, 0xf6758559, 0xd035a164, 0x871dd125}, {0, 0xce}};
|
||||
ULONG result[5];
|
||||
ULONG result_correct[5] = {0xe014f93, 0xe09791ec, 0x6dcf96c8, 0x8e9385fc, 0x1611c1bb};
|
||||
|
||||
hmod = LoadLibrary("advapi32.dll");
|
||||
pA_SHAInit = GetProcAddress(hmod, "A_SHAInit");
|
||||
pA_SHAUpdate = GetProcAddress(hmod, "A_SHAUpdate");
|
||||
pA_SHAFinal = GetProcAddress(hmod, "A_SHAFinal");
|
||||
|
||||
if (!pA_SHAInit || !pA_SHAUpdate || !pA_SHAFinal) return;
|
||||
|
||||
RtlZeroMemory(&ctx, sizeof(ctx));
|
||||
pA_SHAInit(&ctx);
|
||||
ok(!ctxcmp(&ctx, &ctx_initialized), "invalid initialization\n");
|
||||
|
||||
pA_SHAUpdate(&ctx, test_buffer, test_buffer_size);
|
||||
ok(!ctxcmp(&ctx, &ctx_update1), "update doesn't work correctly\n");
|
||||
|
||||
pA_SHAUpdate(&ctx, test_buffer, test_buffer_size);
|
||||
ok(!ctxcmp(&ctx, &ctx_update2), "update doesn't work correctly\n");
|
||||
|
||||
pA_SHAFinal(&ctx, result);
|
||||
ok(!ctxcmp(&ctx, &ctx_initialized), "context hasn't been reinitialized\n");
|
||||
ok(!memcmp(result, result_correct, sizeof(result)), "incorrect result\n");
|
||||
|
||||
FreeLibrary(hmod);
|
||||
}
|
||||
|
||||
START_TEST(crypt_sha)
|
||||
{
|
||||
test_sha_ctx();
|
||||
}
|
33
reactos/lib/advapi32/winetests/makefile
Normal file
33
reactos/lib/advapi32/winetests/makefile
Normal file
@@ -0,0 +1,33 @@
|
||||
# $Id: Makefile 12745 2005-01-03 02:37:10Z sedwards $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
# require os code to explicitly request A/W version of structs/functions
|
||||
TARGET_CFLAGS += -D_DISABLE_TIDENTS -D__USE_W32API -D_WIN32_IE=0x0600 \
|
||||
-D_WIN32_WINNT=0x0501 -D__REACTOS__
|
||||
|
||||
TARGET_NAME = advapi32_test
|
||||
|
||||
TARGET_SDKLIBS = advapi32.a ntdll.a wine.a
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
testlist.o \
|
||||
crypt.o \
|
||||
crypt_lmhash.o \
|
||||
crypt_md4.o \
|
||||
crypt_md5.o \
|
||||
crypt_sha.o \
|
||||
registry.o \
|
||||
security.o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
358
reactos/lib/advapi32/winetests/registry.c
Normal file
358
reactos/lib/advapi32/winetests/registry.c
Normal file
@@ -0,0 +1,358 @@
|
||||
/*
|
||||
* Unit tests for registry functions
|
||||
*
|
||||
* Copyright (c) 2002 Alexandre Julliard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include "wine/test.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
#include "winerror.h"
|
||||
|
||||
static HKEY hkey_main;
|
||||
|
||||
static const char * sTestpath1 = "%LONGSYSTEMVAR%\\subdir1";
|
||||
static const char * sTestpath2 = "%FOO%\\subdir1";
|
||||
|
||||
/* delete key and all its subkeys */
|
||||
static DWORD delete_key( HKEY hkey )
|
||||
{
|
||||
char name[MAX_PATH];
|
||||
DWORD ret;
|
||||
|
||||
while (!(ret = RegEnumKeyA(hkey, 0, name, sizeof(name))))
|
||||
{
|
||||
HKEY tmp;
|
||||
if (!(ret = RegOpenKeyExA( hkey, name, 0, KEY_ENUMERATE_SUB_KEYS, &tmp )))
|
||||
{
|
||||
ret = delete_key( tmp );
|
||||
RegCloseKey( tmp );
|
||||
}
|
||||
if (ret) break;
|
||||
}
|
||||
if (ret != ERROR_NO_MORE_ITEMS) return ret;
|
||||
RegDeleteKeyA( hkey, NULL );
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void setup_main_key(void)
|
||||
{
|
||||
if (RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkey_main )) delete_key( hkey_main );
|
||||
|
||||
assert (!RegCreateKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkey_main ));
|
||||
}
|
||||
|
||||
static void create_test_entries(void)
|
||||
{
|
||||
SetEnvironmentVariableA("LONGSYSTEMVAR", "bar");
|
||||
SetEnvironmentVariableA("FOO", "ImARatherLongButIndeedNeededString");
|
||||
|
||||
ok(!RegSetValueExA(hkey_main,"Test1",0,REG_EXPAND_SZ, sTestpath1, strlen(sTestpath1)+1),
|
||||
"RegSetValueExA failed\n");
|
||||
ok(!RegSetValueExA(hkey_main,"Test2",0,REG_SZ, sTestpath1, strlen(sTestpath1)+1),
|
||||
"RegSetValueExA failed\n");
|
||||
ok(!RegSetValueExA(hkey_main,"Test3",0,REG_EXPAND_SZ, sTestpath2, strlen(sTestpath2)+1),
|
||||
"RegSetValueExA failed\n");
|
||||
}
|
||||
|
||||
static void test_enum_value(void)
|
||||
{
|
||||
DWORD res;
|
||||
char value[20], data[20];
|
||||
WCHAR valueW[20], dataW[20];
|
||||
DWORD val_count, data_count, type;
|
||||
static const WCHAR foobarW[] = {'f','o','o','b','a','r',0};
|
||||
static const WCHAR testW[] = {'T','e','s','t',0};
|
||||
static const WCHAR xxxW[] = {'x','x','x','x','x','x','x','x',0};
|
||||
|
||||
/* check NULL data with zero length */
|
||||
res = RegSetValueExA( hkey_main, "Test", 0, REG_SZ, NULL, 0 );
|
||||
if (GetVersion() & 0x80000000)
|
||||
ok( res == ERROR_INVALID_PARAMETER, "RegSetValueExA returned %ld\n", res );
|
||||
else
|
||||
ok( !res, "RegSetValueExA returned %ld\n", res );
|
||||
res = RegSetValueExA( hkey_main, "Test", 0, REG_EXPAND_SZ, NULL, 0 );
|
||||
ok( !res, "RegSetValueExA returned %ld\n", res );
|
||||
res = RegSetValueExA( hkey_main, "Test", 0, REG_BINARY, NULL, 0 );
|
||||
ok( !res, "RegSetValueExA returned %ld\n", res );
|
||||
|
||||
res = RegSetValueExA( hkey_main, "Test", 0, REG_SZ, (BYTE *)"foobar", 7 );
|
||||
ok( res == 0, "RegSetValueExA failed error %ld\n", res );
|
||||
|
||||
/* overflow both name and data */
|
||||
val_count = 2;
|
||||
data_count = 2;
|
||||
type = 1234;
|
||||
strcpy( value, "xxxxxxxxxx" );
|
||||
strcpy( data, "xxxxxxxxxx" );
|
||||
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
|
||||
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
|
||||
ok( val_count == 2, "val_count set to %ld\n", val_count );
|
||||
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
|
||||
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
|
||||
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
|
||||
ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data );
|
||||
|
||||
/* overflow name */
|
||||
val_count = 3;
|
||||
data_count = 20;
|
||||
type = 1234;
|
||||
strcpy( value, "xxxxxxxxxx" );
|
||||
strcpy( data, "xxxxxxxxxx" );
|
||||
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
|
||||
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
|
||||
/* Win9x returns 2 as specified by MSDN but NT returns 3... */
|
||||
ok( val_count == 2 || val_count == 3, "val_count set to %ld\n", val_count );
|
||||
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
|
||||
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
|
||||
#if 0
|
||||
/* v5.1.2600.0 (XP Home) does not touch value or data in this case */
|
||||
ok( !strcmp( value, "Te" ), "value set to '%s' instead of 'Te'\n", value );
|
||||
ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data );
|
||||
#endif
|
||||
|
||||
/* overflow empty name */
|
||||
val_count = 0;
|
||||
data_count = 20;
|
||||
type = 1234;
|
||||
strcpy( value, "xxxxxxxxxx" );
|
||||
strcpy( data, "xxxxxxxxxx" );
|
||||
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
|
||||
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
|
||||
ok( val_count == 0, "val_count set to %ld\n", val_count );
|
||||
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
|
||||
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
|
||||
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
|
||||
#if 0
|
||||
/* v5.1.2600.0 (XP Home) does not touch data in this case */
|
||||
ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data );
|
||||
#endif
|
||||
|
||||
/* overflow data */
|
||||
val_count = 20;
|
||||
data_count = 2;
|
||||
type = 1234;
|
||||
strcpy( value, "xxxxxxxxxx" );
|
||||
strcpy( data, "xxxxxxxxxx" );
|
||||
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
|
||||
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
|
||||
ok( val_count == 20, "val_count set to %ld\n", val_count );
|
||||
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
|
||||
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
|
||||
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
|
||||
ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data );
|
||||
|
||||
/* no overflow */
|
||||
val_count = 20;
|
||||
data_count = 20;
|
||||
type = 1234;
|
||||
strcpy( value, "xxxxxxxxxx" );
|
||||
strcpy( data, "xxxxxxxxxx" );
|
||||
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
|
||||
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res );
|
||||
ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
|
||||
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
|
||||
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
|
||||
ok( !strcmp( value, "Test" ), "value is '%s' instead of Test\n", value );
|
||||
ok( !strcmp( data, "foobar" ), "data is '%s' instead of foobar\n", data );
|
||||
|
||||
/* Unicode tests */
|
||||
|
||||
SetLastError(0);
|
||||
res = RegSetValueExW( hkey_main, testW, 0, REG_SZ, (const BYTE *)foobarW, 7*sizeof(WCHAR) );
|
||||
if (res==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
|
||||
goto CLEANUP;
|
||||
ok( res == 0, "RegSetValueExW failed error %ld\n", res );
|
||||
|
||||
/* overflow both name and data */
|
||||
val_count = 2;
|
||||
data_count = 2;
|
||||
type = 1234;
|
||||
memcpy( valueW, xxxW, sizeof(xxxW) );
|
||||
memcpy( dataW, xxxW, sizeof(xxxW) );
|
||||
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
|
||||
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
|
||||
ok( val_count == 2, "val_count set to %ld\n", val_count );
|
||||
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
|
||||
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
|
||||
ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" );
|
||||
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
|
||||
|
||||
/* overflow name */
|
||||
val_count = 3;
|
||||
data_count = 20;
|
||||
type = 1234;
|
||||
memcpy( valueW, xxxW, sizeof(xxxW) );
|
||||
memcpy( dataW, xxxW, sizeof(xxxW) );
|
||||
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
|
||||
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
|
||||
ok( val_count == 3, "val_count set to %ld\n", val_count );
|
||||
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
|
||||
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
|
||||
ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" );
|
||||
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
|
||||
|
||||
/* overflow data */
|
||||
val_count = 20;
|
||||
data_count = 2;
|
||||
type = 1234;
|
||||
memcpy( valueW, xxxW, sizeof(xxxW) );
|
||||
memcpy( dataW, xxxW, sizeof(xxxW) );
|
||||
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
|
||||
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
|
||||
ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
|
||||
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
|
||||
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
|
||||
ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" );
|
||||
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
|
||||
|
||||
/* no overflow */
|
||||
val_count = 20;
|
||||
data_count = 20;
|
||||
type = 1234;
|
||||
memcpy( valueW, xxxW, sizeof(xxxW) );
|
||||
memcpy( dataW, xxxW, sizeof(xxxW) );
|
||||
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
|
||||
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res );
|
||||
ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
|
||||
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
|
||||
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
|
||||
ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" );
|
||||
ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'\n" );
|
||||
|
||||
CLEANUP:
|
||||
/* cleanup */
|
||||
RegDeleteValueA( hkey_main, "Test" );
|
||||
}
|
||||
|
||||
static void test_query_value_ex()
|
||||
{
|
||||
DWORD ret;
|
||||
DWORD size;
|
||||
DWORD type;
|
||||
|
||||
ret = RegQueryValueExA(hkey_main, "Test2", NULL, &type, NULL, &size);
|
||||
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
|
||||
ok(size == strlen(sTestpath1) + 1, "(%ld,%ld)\n", (DWORD)strlen(sTestpath1) + 1, size);
|
||||
ok(type == REG_SZ, "type %ld is not REG_SZ\n", type);
|
||||
}
|
||||
|
||||
static void test_reg_open_key()
|
||||
{
|
||||
DWORD ret = 0;
|
||||
HKEY hkResult = NULL;
|
||||
HKEY hkPreserve = NULL;
|
||||
|
||||
/* successful open */
|
||||
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkResult);
|
||||
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
|
||||
ok(hkResult != NULL, "expected hkResult != NULL\n");
|
||||
hkPreserve = hkResult;
|
||||
|
||||
/* open same key twice */
|
||||
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkResult);
|
||||
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
|
||||
ok(hkResult != hkPreserve && hkResult != NULL,
|
||||
"expected hkResult != hkPreserve and hkResult != NULL\n");
|
||||
RegCloseKey(hkResult);
|
||||
|
||||
/* open nonexistent key
|
||||
* check that hkResult is set to NULL
|
||||
*/
|
||||
hkResult = hkPreserve;
|
||||
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Nonexistent", &hkResult);
|
||||
ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %ld\n", ret);
|
||||
ok(hkResult == NULL, "expected hkResult == NULL\n");
|
||||
|
||||
/* open the same nonexistent key again to make sure the key wasn't created */
|
||||
hkResult = hkPreserve;
|
||||
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Nonexistent", &hkResult);
|
||||
ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %ld\n", ret);
|
||||
ok(hkResult == NULL, "expected hkResult == NULL\n");
|
||||
|
||||
/* send in NULL lpSubKey
|
||||
* check that hkResult receives the value of hKey
|
||||
*/
|
||||
hkResult = hkPreserve;
|
||||
ret = RegOpenKeyA(HKEY_CURRENT_USER, NULL, &hkResult);
|
||||
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
|
||||
ok(hkResult == HKEY_CURRENT_USER, "expected hkResult == HKEY_CURRENT_USER\n");
|
||||
|
||||
/* send empty-string in lpSubKey */
|
||||
hkResult = hkPreserve;
|
||||
ret = RegOpenKeyA(HKEY_CURRENT_USER, "", &hkResult);
|
||||
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
|
||||
ok(hkResult == HKEY_CURRENT_USER, "expected hkResult == HKEY_CURRENT_USER\n");
|
||||
|
||||
/* send in NULL lpSubKey and NULL hKey
|
||||
* hkResult is set to NULL
|
||||
*/
|
||||
hkResult = hkPreserve;
|
||||
ret = RegOpenKeyA(NULL, NULL, &hkResult);
|
||||
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
|
||||
ok(hkResult == NULL, "expected hkResult == NULL\n");
|
||||
|
||||
/* only send NULL hKey
|
||||
* the value of hkResult remains unchanged
|
||||
*/
|
||||
hkResult = hkPreserve;
|
||||
ret = RegOpenKeyA(NULL, "Software\\Wine\\Test", &hkResult);
|
||||
ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %ld\n", ret);
|
||||
ok(hkResult == hkPreserve, "expected hkResult == hkPreserve\n");
|
||||
RegCloseKey(hkResult);
|
||||
|
||||
/* send in NULL hkResult */
|
||||
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", NULL);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret);
|
||||
}
|
||||
|
||||
static void test_reg_close_key()
|
||||
{
|
||||
DWORD ret = 0;
|
||||
HKEY hkHandle;
|
||||
|
||||
/* successfully close key
|
||||
* hkHandle remains changed after call to RegCloseKey
|
||||
*/
|
||||
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkHandle);
|
||||
ret = RegCloseKey(hkHandle);
|
||||
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
|
||||
|
||||
/* try to close the key twice */
|
||||
ret = RegCloseKey(hkHandle);
|
||||
ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %ld\n", ret);
|
||||
|
||||
/* try to close a NULL handle */
|
||||
ret = RegCloseKey(NULL);
|
||||
ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %ld\n", ret);
|
||||
}
|
||||
|
||||
START_TEST(registry)
|
||||
{
|
||||
setup_main_key();
|
||||
create_test_entries();
|
||||
test_enum_value();
|
||||
test_query_value_ex();
|
||||
test_reg_open_key();
|
||||
test_reg_close_key();
|
||||
|
||||
/* cleanup */
|
||||
delete_key( hkey_main );
|
||||
}
|
408
reactos/lib/advapi32/winetests/security.c
Normal file
408
reactos/lib/advapi32/winetests/security.c
Normal file
@@ -0,0 +1,408 @@
|
||||
/*
|
||||
* Unit tests for security functions
|
||||
*
|
||||
* Copyright (c) 2004 Mike McCormack
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "aclapi.h"
|
||||
#include "winnt.h"
|
||||
|
||||
typedef BOOL (WINAPI *fnBuildTrusteeWithSidA)( TRUSTEE *trustee, PSID psid );
|
||||
typedef BOOL (WINAPI *fnBuildTrusteeWithNameA)( TRUSTEE *trustee, LPSTR str );
|
||||
typedef BOOL (WINAPI *fnConvertSidToStringSidA)( PSID pSid, LPSTR *str );
|
||||
typedef BOOL (WINAPI *fnConvertStringSidToSidA)( LPCSTR str, PSID pSid );
|
||||
|
||||
static HMODULE hmod;
|
||||
|
||||
fnBuildTrusteeWithSidA pBuildTrusteeWithSidA;
|
||||
fnBuildTrusteeWithNameA pBuildTrusteeWithNameA;
|
||||
fnConvertSidToStringSidA pConvertSidToStringSidA;
|
||||
fnConvertStringSidToSidA pConvertStringSidToSidA;
|
||||
|
||||
struct sidRef
|
||||
{
|
||||
SID_IDENTIFIER_AUTHORITY auth;
|
||||
const char *refStr;
|
||||
};
|
||||
|
||||
static void init(void)
|
||||
{
|
||||
hmod = GetModuleHandle("advapi32.dll");
|
||||
}
|
||||
|
||||
void test_sid()
|
||||
{
|
||||
struct sidRef refs[] = {
|
||||
{ { {0x00,0x00,0x33,0x44,0x55,0x66} }, "S-1-860116326-1" },
|
||||
{ { {0x00,0x00,0x01,0x02,0x03,0x04} }, "S-1-16909060-1" },
|
||||
{ { {0x00,0x00,0x00,0x01,0x02,0x03} }, "S-1-66051-1" },
|
||||
{ { {0x00,0x00,0x00,0x00,0x01,0x02} }, "S-1-258-1" },
|
||||
{ { {0x00,0x00,0x00,0x00,0x00,0x02} }, "S-1-2-1" },
|
||||
{ { {0x00,0x00,0x00,0x00,0x00,0x0c} }, "S-1-12-1" },
|
||||
};
|
||||
const char noSubAuthStr[] = "S-1-5";
|
||||
unsigned int i;
|
||||
PSID psid = NULL;
|
||||
BOOL r;
|
||||
LPSTR str = NULL;
|
||||
|
||||
pConvertSidToStringSidA = (fnConvertSidToStringSidA)
|
||||
GetProcAddress( hmod, "ConvertSidToStringSidA" );
|
||||
if( !pConvertSidToStringSidA )
|
||||
return;
|
||||
pConvertStringSidToSidA = (fnConvertStringSidToSidA)
|
||||
GetProcAddress( hmod, "ConvertStringSidToSidA" );
|
||||
if( !pConvertStringSidToSidA )
|
||||
return;
|
||||
|
||||
r = pConvertStringSidToSidA( NULL, NULL );
|
||||
ok( !r, "expected failure with NULL parameters\n" );
|
||||
if( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED )
|
||||
return;
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n",
|
||||
GetLastError() );
|
||||
|
||||
r = pConvertStringSidToSidA( refs[0].refStr, NULL );
|
||||
ok( !r && GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n",
|
||||
GetLastError() );
|
||||
|
||||
r = pConvertStringSidToSidA( NULL, &str );
|
||||
ok( !r && GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n",
|
||||
GetLastError() );
|
||||
|
||||
r = pConvertStringSidToSidA( noSubAuthStr, &psid );
|
||||
ok( !r,
|
||||
"expected failure with no sub authorities\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_SID,
|
||||
"expected GetLastError() is ERROR_INVALID_SID, got %ld\n",
|
||||
GetLastError() );
|
||||
|
||||
for( i = 0; i < sizeof(refs) / sizeof(refs[0]); i++ )
|
||||
{
|
||||
PISID pisid;
|
||||
|
||||
r = AllocateAndInitializeSid( &refs[i].auth, 1,1,0,0,0,0,0,0,0,
|
||||
&psid );
|
||||
ok( r, "failed to allocate sid\n" );
|
||||
r = pConvertSidToStringSidA( psid, &str );
|
||||
ok( r, "failed to convert sid\n" );
|
||||
ok( !strcmp( str, refs[i].refStr ),
|
||||
"incorrect sid, expected %s, got %s\n", refs[i].refStr, str );
|
||||
if( str )
|
||||
LocalFree( str );
|
||||
if( psid )
|
||||
FreeSid( psid );
|
||||
|
||||
r = pConvertStringSidToSidA( refs[i].refStr, &psid );
|
||||
ok( r, "failed to parse sid string\n" );
|
||||
pisid = (PISID)psid;
|
||||
ok( pisid &&
|
||||
!memcmp( pisid->IdentifierAuthority.Value, refs[i].auth.Value,
|
||||
sizeof(refs[i].auth) ),
|
||||
"string sid %s didn't parse to expected value\n"
|
||||
"(got 0x%04x%08lx, expected 0x%04x%08lx)\n",
|
||||
refs[i].refStr,
|
||||
MAKEWORD( pisid->IdentifierAuthority.Value[1],
|
||||
pisid->IdentifierAuthority.Value[0] ),
|
||||
MAKELONG( MAKEWORD( pisid->IdentifierAuthority.Value[5],
|
||||
pisid->IdentifierAuthority.Value[4] ),
|
||||
MAKEWORD( pisid->IdentifierAuthority.Value[3],
|
||||
pisid->IdentifierAuthority.Value[2] ) ),
|
||||
MAKEWORD( refs[i].auth.Value[1], refs[i].auth.Value[0] ),
|
||||
MAKELONG( MAKEWORD( refs[i].auth.Value[5], refs[i].auth.Value[4] ),
|
||||
MAKEWORD( refs[i].auth.Value[3], refs[i].auth.Value[2] ) ) );
|
||||
if( psid )
|
||||
LocalFree( psid );
|
||||
}
|
||||
}
|
||||
|
||||
void test_trustee()
|
||||
{
|
||||
TRUSTEE trustee;
|
||||
PSID psid;
|
||||
LPSTR str = "2jjj";
|
||||
|
||||
SID_IDENTIFIER_AUTHORITY auth = { {0x11,0x22,0,0,0, 0} };
|
||||
|
||||
pBuildTrusteeWithSidA = (fnBuildTrusteeWithSidA)
|
||||
GetProcAddress( hmod, "BuildTrusteeWithSidA" );
|
||||
pBuildTrusteeWithNameA = (fnBuildTrusteeWithNameA)
|
||||
GetProcAddress( hmod, "BuildTrusteeWithNameA" );
|
||||
if( !pBuildTrusteeWithSidA || !pBuildTrusteeWithNameA)
|
||||
return;
|
||||
|
||||
if ( ! AllocateAndInitializeSid( &auth, 1, 42, 0,0,0,0,0,0,0,&psid ) )
|
||||
{
|
||||
trace( "failed to init SID\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
memset( &trustee, 0xff, sizeof trustee );
|
||||
pBuildTrusteeWithSidA( &trustee, psid );
|
||||
|
||||
ok( trustee.pMultipleTrustee == NULL, "pMultipleTrustee wrong\n");
|
||||
ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE,
|
||||
"MultipleTrusteeOperation wrong\n");
|
||||
ok( trustee.TrusteeForm == TRUSTEE_IS_SID, "TrusteeForm wrong\n");
|
||||
ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n");
|
||||
ok( trustee.ptstrName == (LPSTR) psid, "ptstrName wrong\n" );
|
||||
FreeSid( psid );
|
||||
|
||||
/* test BuildTrusteeWithNameA */
|
||||
memset( &trustee, 0xff, sizeof trustee );
|
||||
pBuildTrusteeWithNameA( &trustee, str );
|
||||
|
||||
ok( trustee.pMultipleTrustee == NULL, "pMultipleTrustee wrong\n");
|
||||
ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE,
|
||||
"MultipleTrusteeOperation wrong\n");
|
||||
ok( trustee.TrusteeForm == TRUSTEE_IS_NAME, "TrusteeForm wrong\n");
|
||||
ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n");
|
||||
ok( trustee.ptstrName == str, "ptstrName wrong\n" );
|
||||
}
|
||||
|
||||
/* If the first isn't defined, assume none is */
|
||||
#ifndef SE_MIN_WELL_KNOWN_PRIVILEGE
|
||||
#define SE_MIN_WELL_KNOWN_PRIVILEGE 2L
|
||||
#define SE_CREATE_TOKEN_PRIVILEGE 2L
|
||||
#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE 3L
|
||||
#define SE_LOCK_MEMORY_PRIVILEGE 4L
|
||||
#define SE_INCREASE_QUOTA_PRIVILEGE 5L
|
||||
#define SE_MACHINE_ACCOUNT_PRIVILEGE 6L
|
||||
#define SE_TCB_PRIVILEGE 7L
|
||||
#define SE_SECURITY_PRIVILEGE 8L
|
||||
#define SE_TAKE_OWNERSHIP_PRIVILEGE 9L
|
||||
#define SE_LOAD_DRIVER_PRIVILEGE 10L
|
||||
#define SE_SYSTEM_PROFILE_PRIVILEGE 11L
|
||||
#define SE_SYSTEMTIME_PRIVILEGE 12L
|
||||
#define SE_PROF_SINGLE_PROCESS_PRIVILEGE 13L
|
||||
#define SE_INC_BASE_PRIORITY_PRIVILEGE 14L
|
||||
#define SE_CREATE_PAGEFILE_PRIVILEGE 15L
|
||||
#define SE_CREATE_PERMANENT_PRIVILEGE 16L
|
||||
#define SE_BACKUP_PRIVILEGE 17L
|
||||
#define SE_RESTORE_PRIVILEGE 18L
|
||||
#define SE_SHUTDOWN_PRIVILEGE 19L
|
||||
#define SE_DEBUG_PRIVILEGE 20L
|
||||
#define SE_AUDIT_PRIVILEGE 21L
|
||||
#define SE_SYSTEM_ENVIRONMENT_PRIVILEGE 22L
|
||||
#define SE_CHANGE_NOTIFY_PRIVILLEGE 23L
|
||||
#define SE_REMOTE_SHUTDOWN_PRIVILEGE 24L
|
||||
#define SE_UNDOCK_PRIVILEGE 25L
|
||||
#define SE_SYNC_AGENT_PRIVILEGE 26L
|
||||
#define SE_ENABLE_DELEGATION_PRIVILEGE 27L
|
||||
#define SE_MANAGE_VOLUME_PRIVILEGE 28L
|
||||
#define SE_IMPERSONATE_PRIVILEGE 29L
|
||||
#define SE_CREATE_GLOBAL_PRIVILEGE 30L
|
||||
#define SE_MAX_WELL_KNOWN_PRIVILEGE SE_CREATE_GLOBAL_PRIVILEGE
|
||||
#endif /* ndef SE_MIN_WELL_KNOWN_PRIVILEGE */
|
||||
|
||||
static void test_allocateLuid(void)
|
||||
{
|
||||
BOOL (WINAPI *pAllocateLocallyUniqueId)(PLUID);
|
||||
LUID luid1, luid2;
|
||||
BOOL ret;
|
||||
|
||||
pAllocateLocallyUniqueId = (void*)GetProcAddress(hmod, "AllocateLocallyUniqueId");
|
||||
if (!pAllocateLocallyUniqueId) return;
|
||||
|
||||
ret = pAllocateLocallyUniqueId(&luid1);
|
||||
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||
return;
|
||||
|
||||
ok(ret,
|
||||
"AllocateLocallyUniqueId failed: %ld\n", GetLastError());
|
||||
ret = pAllocateLocallyUniqueId(&luid2);
|
||||
ok( ret,
|
||||
"AllocateLocallyUniqueId failed: %ld\n", GetLastError());
|
||||
ok(luid1.LowPart > SE_MAX_WELL_KNOWN_PRIVILEGE || luid1.HighPart != 0,
|
||||
"AllocateLocallyUniqueId returned a well-known LUID\n");
|
||||
ok(luid1.LowPart != luid2.LowPart || luid1.HighPart != luid2.HighPart,
|
||||
"AllocateLocallyUniqueId returned non-unique LUIDs\n");
|
||||
ret = pAllocateLocallyUniqueId(NULL);
|
||||
ok( !ret && GetLastError() == ERROR_NOACCESS,
|
||||
"AllocateLocallyUniqueId(NULL) didn't return ERROR_NOACCESS: %ld\n",
|
||||
GetLastError());
|
||||
}
|
||||
|
||||
static void test_lookupPrivilegeName(void)
|
||||
{
|
||||
BOOL (WINAPI *pLookupPrivilegeNameA)(LPSTR, PLUID, LPSTR, LPDWORD);
|
||||
char buf[MAX_PATH]; /* arbitrary, seems long enough */
|
||||
DWORD cchName = sizeof(buf);
|
||||
LUID luid = { 0, 0 };
|
||||
LONG i;
|
||||
BOOL ret;
|
||||
|
||||
/* check whether it's available first */
|
||||
pLookupPrivilegeNameA = (void*)GetProcAddress(hmod, "LookupPrivilegeNameA");
|
||||
if (!pLookupPrivilegeNameA) return;
|
||||
luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE;
|
||||
ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName);
|
||||
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||
return;
|
||||
|
||||
/* check with a short buffer */
|
||||
cchName = 0;
|
||||
luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE;
|
||||
ret = pLookupPrivilegeNameA(NULL, &luid, NULL, &cchName);
|
||||
ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"LookupPrivilegeNameA didn't fail with ERROR_INSUFFICIENT_BUFFER: %ld\n",
|
||||
GetLastError());
|
||||
ok(cchName == strlen("SeCreateTokenPrivilege") + 1,
|
||||
"LookupPrivilegeNameA returned an incorrect required length for\n"
|
||||
"SeCreateTokenPrivilege (got %ld, expected %d)\n", cchName,
|
||||
strlen("SeCreateTokenPrivilege") + 1);
|
||||
/* check a known value and its returned length on success */
|
||||
cchName = sizeof(buf);
|
||||
ok(pLookupPrivilegeNameA(NULL, &luid, buf, &cchName) &&
|
||||
cchName == strlen("SeCreateTokenPrivilege"),
|
||||
"LookupPrivilegeNameA returned an incorrect output length for\n"
|
||||
"SeCreateTokenPrivilege (got %ld, expected %d)\n", cchName,
|
||||
(int)strlen("SeCreateTokenPrivilege"));
|
||||
/* check known values */
|
||||
for (i = SE_MIN_WELL_KNOWN_PRIVILEGE; i < SE_MAX_WELL_KNOWN_PRIVILEGE; i++)
|
||||
{
|
||||
luid.LowPart = i;
|
||||
cchName = sizeof(buf);
|
||||
ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName);
|
||||
ok( ret && GetLastError() != ERROR_NO_SUCH_PRIVILEGE,
|
||||
"LookupPrivilegeNameA(0.%ld) failed: %ld\n", i, GetLastError());
|
||||
}
|
||||
/* check a bogus LUID */
|
||||
luid.LowPart = 0xdeadbeef;
|
||||
cchName = sizeof(buf);
|
||||
ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName);
|
||||
ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
|
||||
"LookupPrivilegeNameA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
|
||||
GetLastError());
|
||||
/* check on a bogus system */
|
||||
luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE;
|
||||
cchName = sizeof(buf);
|
||||
ret = pLookupPrivilegeNameA("b0gu5.Nam3", &luid, buf, &cchName);
|
||||
ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE,
|
||||
"LookupPrivilegeNameA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n",
|
||||
GetLastError());
|
||||
}
|
||||
|
||||
struct NameToLUID
|
||||
{
|
||||
const char *name;
|
||||
DWORD lowPart;
|
||||
};
|
||||
|
||||
static void test_lookupPrivilegeValue(void)
|
||||
{
|
||||
static const struct NameToLUID privs[] = {
|
||||
{ "SeCreateTokenPrivilege", SE_CREATE_TOKEN_PRIVILEGE },
|
||||
{ "SeAssignPrimaryTokenPrivilege", SE_ASSIGNPRIMARYTOKEN_PRIVILEGE },
|
||||
{ "SeLockMemoryPrivilege", SE_LOCK_MEMORY_PRIVILEGE },
|
||||
{ "SeIncreaseQuotaPrivilege", SE_INCREASE_QUOTA_PRIVILEGE },
|
||||
{ "SeMachineAccountPrivilege", SE_MACHINE_ACCOUNT_PRIVILEGE },
|
||||
{ "SeTcbPrivilege", SE_TCB_PRIVILEGE },
|
||||
{ "SeSecurityPrivilege", SE_SECURITY_PRIVILEGE },
|
||||
{ "SeTakeOwnershipPrivilege", SE_TAKE_OWNERSHIP_PRIVILEGE },
|
||||
{ "SeLoadDriverPrivilege", SE_LOAD_DRIVER_PRIVILEGE },
|
||||
{ "SeSystemProfilePrivilege", SE_SYSTEM_PROFILE_PRIVILEGE },
|
||||
{ "SeSystemtimePrivilege", SE_SYSTEMTIME_PRIVILEGE },
|
||||
{ "SeProfileSingleProcessPrivilege", SE_PROF_SINGLE_PROCESS_PRIVILEGE },
|
||||
{ "SeIncreaseBasePriorityPrivilege", SE_INC_BASE_PRIORITY_PRIVILEGE },
|
||||
{ "SeCreatePagefilePrivilege", SE_CREATE_PAGEFILE_PRIVILEGE },
|
||||
{ "SeCreatePermanentPrivilege", SE_CREATE_PERMANENT_PRIVILEGE },
|
||||
{ "SeBackupPrivilege", SE_BACKUP_PRIVILEGE },
|
||||
{ "SeRestorePrivilege", SE_RESTORE_PRIVILEGE },
|
||||
{ "SeShutdownPrivilege", SE_SHUTDOWN_PRIVILEGE },
|
||||
{ "SeDebugPrivilege", SE_DEBUG_PRIVILEGE },
|
||||
{ "SeAuditPrivilege", SE_AUDIT_PRIVILEGE },
|
||||
{ "SeSystemEnvironmentPrivilege", SE_SYSTEM_ENVIRONMENT_PRIVILEGE },
|
||||
{ "SeChangeNotifyPrivilege", SE_CHANGE_NOTIFY_PRIVILLEGE },
|
||||
{ "SeRemoteShutdownPrivilege", SE_REMOTE_SHUTDOWN_PRIVILEGE },
|
||||
{ "SeUndockPrivilege", SE_UNDOCK_PRIVILEGE },
|
||||
{ "SeSyncAgentPrivilege", SE_SYNC_AGENT_PRIVILEGE },
|
||||
{ "SeEnableDelegationPrivilege", SE_ENABLE_DELEGATION_PRIVILEGE },
|
||||
{ "SeManageVolumePrivilege", SE_MANAGE_VOLUME_PRIVILEGE },
|
||||
{ "SeImpersonatePrivilege", SE_IMPERSONATE_PRIVILEGE },
|
||||
{ "SeCreateGlobalPrivilege", SE_CREATE_GLOBAL_PRIVILEGE },
|
||||
};
|
||||
BOOL (WINAPI *pLookupPrivilegeValueA)(LPCSTR, LPCSTR, PLUID);
|
||||
int i;
|
||||
LUID luid;
|
||||
BOOL ret;
|
||||
|
||||
/* check whether it's available first */
|
||||
pLookupPrivilegeValueA = (void*)GetProcAddress(hmod, "LookupPrivilegeValueA");
|
||||
if (!pLookupPrivilegeValueA) return;
|
||||
ret = pLookupPrivilegeValueA(NULL, "SeCreateTokenPrivilege", &luid);
|
||||
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||
return;
|
||||
|
||||
/* check a bogus system name */
|
||||
ret = pLookupPrivilegeValueA("b0gu5.Nam3", "SeCreateTokenPrivilege", &luid);
|
||||
ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE,
|
||||
"LookupPrivilegeValueA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n",
|
||||
GetLastError());
|
||||
/* check a NULL string */
|
||||
ret = pLookupPrivilegeValueA(NULL, 0, &luid);
|
||||
ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
|
||||
"LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
|
||||
GetLastError());
|
||||
/* check a bogus privilege name */
|
||||
ret = pLookupPrivilegeValueA(NULL, "SeBogusPrivilege", &luid);
|
||||
ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
|
||||
"LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
|
||||
GetLastError());
|
||||
/* check case insensitive */
|
||||
ret = pLookupPrivilegeValueA(NULL, "sEcREATEtOKENpRIVILEGE", &luid);
|
||||
ok( ret,
|
||||
"LookupPrivilegeValueA(NULL, sEcREATEtOKENpRIVILEGE, &luid) failed: %ld\n",
|
||||
GetLastError());
|
||||
for (i = 0; i < sizeof(privs) / sizeof(privs[0]); i++)
|
||||
{
|
||||
/* Not all privileges are implemented on all Windows versions, so
|
||||
* don't worry if the call fails
|
||||
*/
|
||||
if (pLookupPrivilegeValueA(NULL, privs[i].name, &luid))
|
||||
{
|
||||
ok(luid.LowPart == privs[i].lowPart,
|
||||
"LookupPrivilegeValueA returned an invalid LUID for %s\n",
|
||||
privs[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void test_luid(void)
|
||||
{
|
||||
test_allocateLuid();
|
||||
test_lookupPrivilegeName();
|
||||
test_lookupPrivilegeValue();
|
||||
}
|
||||
|
||||
START_TEST(security)
|
||||
{
|
||||
init();
|
||||
if (!hmod) return;
|
||||
test_sid();
|
||||
test_trustee();
|
||||
test_luid();
|
||||
}
|
37
reactos/lib/advapi32/winetests/testlist.c
Normal file
37
reactos/lib/advapi32/winetests/testlist.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
/* stdarg.h is needed for Winelib */
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
extern void func_crypt(void);
|
||||
extern void func_crypt_lmhash(void);
|
||||
extern void func_crypt_md4(void);
|
||||
extern void func_crypt_md5(void);
|
||||
extern void func_crypt_sha(void);
|
||||
extern void func_registry(void);
|
||||
extern void func_security(void);
|
||||
|
||||
struct test
|
||||
{
|
||||
const char *name;
|
||||
void (*func)(void);
|
||||
};
|
||||
|
||||
static const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "crypt", func_crypt },
|
||||
{ "crypt_lmhash", func_crypt_lmhash },
|
||||
{ "crypt_md4", func_crypt_md4 },
|
||||
{ "crypt_md5", func_crypt_md5 },
|
||||
{ "crypt_sha", func_crypt_sha },
|
||||
{ "registry", func_registry },
|
||||
{ "security", func_security },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
#define WINETEST_WANT_MAIN
|
||||
#include "wine/test.h"
|
@@ -101,10 +101,10 @@
|
||||
402 stdcall -noname FindMRUStringW(long wstr ptr)
|
||||
403 stdcall -noname EnumMRUListW(long long ptr long)
|
||||
404 stdcall -noname CreateMRUListLazyW(ptr long long long)
|
||||
410 stdcall SetWindowSubclass(long ptr long long)
|
||||
411 stdcall GetWindowSubclass(long ptr long ptr)
|
||||
412 stdcall RemoveWindowSubclass(long ptr long)
|
||||
413 stdcall DefSubclassProc(long long long long)
|
||||
410 stdcall -noname SetWindowSubclass(long ptr long long)
|
||||
411 stdcall -noname GetWindowSubclass(long ptr long ptr)
|
||||
412 stdcall -noname RemoveWindowSubclass(long ptr long)
|
||||
413 stdcall -noname DefSubclassProc(long long long long)
|
||||
414 stdcall -noname MirrorIcon(ptr ptr)
|
||||
415 stdcall DrawTextWrap(long wstr long ptr long) user32.DrawTextW
|
||||
416 stdcall DrawTextExPrivWrap(long wstr long ptr long ptr) user32.DrawTextExW
|
||||
|
@@ -16,7 +16,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_SPANISH, SUBLANG_DEFAULT
|
||||
LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
|
||||
|
||||
IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
|
||||
STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
|
||||
|
@@ -42,10 +42,6 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
|
||||
|
||||
/* for compiler compatibility we only accept literal ASCII strings */
|
||||
#undef TEXT
|
||||
#define TEXT(string) string
|
||||
|
||||
#define DRAGLIST_SUBCLASSID 0
|
||||
#define DRAGLIST_SCROLLPERIOD 200
|
||||
#define DRAGLIST_TIMERID 666
|
||||
@@ -95,7 +91,7 @@ static LRESULT DragList_Notify(HWND hwndLB, UINT uNotification)
|
||||
}
|
||||
|
||||
/* cleans up after dragging */
|
||||
static inline void DragList_EndDrag(HWND hwnd, DRAGLISTDATA * data)
|
||||
static void DragList_EndDrag(HWND hwnd, DRAGLISTDATA * data)
|
||||
{
|
||||
KillTimer(hwnd, DRAGLIST_TIMERID);
|
||||
ReleaseCapture();
|
||||
@@ -207,12 +203,12 @@ DragList_SubclassWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
|
||||
*/
|
||||
BOOL WINAPI MakeDragList (HWND hwndLB)
|
||||
{
|
||||
DRAGLISTDATA * data = Alloc(sizeof(DRAGLISTDATA));
|
||||
DRAGLISTDATA *data = Alloc(sizeof(DRAGLISTDATA));
|
||||
|
||||
TRACE("(%p)\n", hwndLB);
|
||||
|
||||
if (!uDragListMessage)
|
||||
uDragListMessage = RegisterWindowMessageA(DRAGLISTMSGSTRING);
|
||||
uDragListMessage = RegisterWindowMessageW(DRAGLISTMSGSTRINGW);
|
||||
|
||||
return SetWindowSubclass(hwndLB, DragList_SubclassWindowProc, DRAGLIST_SUBCLASSID, (DWORD_PTR)data);
|
||||
}
|
||||
@@ -301,14 +297,14 @@ INT WINAPI LBItemFromPt (HWND hwndLB, POINT pt, BOOL bAutoScroll)
|
||||
|
||||
ScreenToClient (hwndLB, &pt);
|
||||
GetClientRect (hwndLB, &rcClient);
|
||||
nIndex = (INT)SendMessageA (hwndLB, LB_GETTOPINDEX, 0, 0);
|
||||
nIndex = (INT)SendMessageW (hwndLB, LB_GETTOPINDEX, 0, 0);
|
||||
|
||||
if (PtInRect (&rcClient, pt))
|
||||
{
|
||||
/* point is inside -- get the item index */
|
||||
while (TRUE)
|
||||
{
|
||||
if (SendMessageA (hwndLB, LB_GETITEMRECT, nIndex, (LPARAM)&rcClient) == LB_ERR)
|
||||
if (SendMessageW (hwndLB, LB_GETITEMRECT, nIndex, (LPARAM)&rcClient) == LB_ERR)
|
||||
return -1;
|
||||
|
||||
if (PtInRect (&rcClient, pt))
|
||||
@@ -338,7 +334,7 @@ INT WINAPI LBItemFromPt (HWND hwndLB, POINT pt, BOOL bAutoScroll)
|
||||
|
||||
dwLastScrollTime = dwScrollTime;
|
||||
|
||||
SendMessageA (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
|
||||
SendMessageW (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@@ -324,9 +324,19 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
|
||||
}
|
||||
else
|
||||
tx = 0;
|
||||
ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, r.left + tx + 2*infoPtr->iMargin,
|
||||
r.top + (r.bottom-r.top-infoPtr->himl->cy)/2, infoPtr->himl->cx, r.bottom-r.top,
|
||||
CLR_DEFAULT, CLR_DEFAULT, 0);
|
||||
|
||||
if (tx < (r.right-r.left - infoPtr->himl->cx - GetSystemMetrics(SM_CXEDGE)))
|
||||
ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, r.left + tx + 2*infoPtr->iMargin,
|
||||
r.top + (r.bottom-r.top-infoPtr->himl->cy)/2, infoPtr->himl->cx, r.bottom-r.top,
|
||||
CLR_DEFAULT, CLR_DEFAULT, 0);
|
||||
else {
|
||||
INT x = max(r.right - infoPtr->iMargin - infoPtr->himl->cx, r.left);
|
||||
INT cx = min(infoPtr->himl->cx, r.right-r.left - GetSystemMetrics(SM_CXEDGE));
|
||||
ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, x ,
|
||||
r.top + (r.bottom-r.top-infoPtr->himl->cy)/2, cx, r.bottom-r.top,
|
||||
CLR_DEFAULT, CLR_DEFAULT, 0);
|
||||
r.right -= infoPtr->himl->cx - infoPtr->iMargin;
|
||||
}
|
||||
}
|
||||
|
||||
if (((phdi->fmt & HDF_STRING)
|
||||
@@ -1203,10 +1213,8 @@ HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
lpItem->iOrder = phdi->iOrder;
|
||||
}
|
||||
else
|
||||
lpItem->iOrder = nItem;
|
||||
|
||||
HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGEDA, nItem, phdi->mask);
|
||||
HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGEDA, nItem, phdi->mask);
|
||||
|
||||
HEADER_SetItemBounds (hwnd);
|
||||
|
||||
@@ -1270,10 +1278,8 @@ HEADER_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
lpItem->iOrder = phdi->iOrder;
|
||||
}
|
||||
else
|
||||
lpItem->iOrder = nItem;
|
||||
|
||||
HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGEDW, nItem, phdi->mask);
|
||||
HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGEDW, nItem, phdi->mask);
|
||||
|
||||
HEADER_SetItemBounds (hwnd);
|
||||
|
||||
|
@@ -1577,84 +1577,28 @@ ImageList_GetImageRect (HIMAGELIST himl, INT i, LPRECT lpRect)
|
||||
*
|
||||
* Creates an image list from a bitmap, icon or cursor.
|
||||
*
|
||||
* PARAMS
|
||||
* hi [I] instance handle
|
||||
* lpbmp [I] name or id of the image
|
||||
* cx [I] width of each image
|
||||
* cGrow [I] number of images to expand
|
||||
* clrMask [I] mask color
|
||||
* uType [I] type of image to load
|
||||
* uFlags [I] loading flags
|
||||
*
|
||||
* RETURNS
|
||||
* Success: handle to the loaded image list
|
||||
* Failure: NULL
|
||||
*
|
||||
* SEE
|
||||
* LoadImage ()
|
||||
* ImageList_LoadImageW ()
|
||||
*/
|
||||
|
||||
HIMAGELIST WINAPI
|
||||
ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow,
|
||||
COLORREF clrMask, UINT uType, UINT uFlags)
|
||||
{
|
||||
HIMAGELIST himl = NULL;
|
||||
HANDLE handle;
|
||||
INT nImageCount;
|
||||
HIMAGELIST himl;
|
||||
LPWSTR lpbmpW;
|
||||
DWORD len;
|
||||
|
||||
handle = LoadImageA (hi, lpbmp, uType, 0, 0, uFlags);
|
||||
if (!handle) {
|
||||
ERR("Error loading image!\n");
|
||||
return NULL;
|
||||
}
|
||||
if (!HIWORD(lpbmp))
|
||||
return ImageList_LoadImageW(hi, (LPCWSTR)lpbmp, cx, cGrow, clrMask,
|
||||
uType, uFlags);
|
||||
|
||||
if (uType == IMAGE_BITMAP) {
|
||||
BITMAP bmp;
|
||||
GetObjectA (handle, sizeof(BITMAP), &bmp);
|
||||
|
||||
/* To match windows behavior, if cx is set to zero and
|
||||
the flag DI_DEFAULTSIZE is specified, cx becomes the
|
||||
system metric value for icons. If the flag is not specified
|
||||
the function sets the size to the height of the bitmap */
|
||||
if (cx == 0)
|
||||
{
|
||||
if (uFlags & DI_DEFAULTSIZE)
|
||||
cx = GetSystemMetrics (SM_CXICON);
|
||||
else
|
||||
cx = bmp.bmHeight;
|
||||
}
|
||||
|
||||
nImageCount = bmp.bmWidth / cx;
|
||||
|
||||
himl = ImageList_Create (cx, bmp.bmHeight, ILC_MASK | ILC_COLOR,
|
||||
nImageCount, cGrow);
|
||||
if (!himl) {
|
||||
DeleteObject (handle);
|
||||
return NULL;
|
||||
}
|
||||
ImageList_AddMasked (himl, (HBITMAP)handle, clrMask);
|
||||
}
|
||||
else if ((uType == IMAGE_ICON) || (uType == IMAGE_CURSOR)) {
|
||||
ICONINFO ii;
|
||||
BITMAP bmp;
|
||||
|
||||
GetIconInfo (handle, &ii);
|
||||
GetObjectA (ii.hbmColor, sizeof(BITMAP), (LPVOID)&bmp);
|
||||
himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
|
||||
ILC_MASK | ILC_COLOR, 1, cGrow);
|
||||
if (!himl) {
|
||||
DeleteObject (ii.hbmColor);
|
||||
DeleteObject (ii.hbmMask);
|
||||
DeleteObject (handle);
|
||||
return NULL;
|
||||
}
|
||||
ImageList_Add (himl, ii.hbmColor, ii.hbmMask);
|
||||
DeleteObject (ii.hbmColor);
|
||||
DeleteObject (ii.hbmMask);
|
||||
}
|
||||
|
||||
DeleteObject (handle);
|
||||
len = MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, NULL, 0);
|
||||
lpbmpW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, lpbmpW, len);
|
||||
|
||||
himl = ImageList_LoadImageW(hi, lpbmpW, cx, cGrow, clrMask, uType, uFlags);
|
||||
HeapFree(GetProcessHeap(), 0, lpbmpW);
|
||||
return himl;
|
||||
}
|
||||
|
||||
@@ -1683,7 +1627,7 @@ ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow,
|
||||
|
||||
HIMAGELIST WINAPI
|
||||
ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow,
|
||||
COLORREF clrMask, UINT uType, UINT uFlags)
|
||||
COLORREF clrMask, UINT uType, UINT uFlags)
|
||||
{
|
||||
HIMAGELIST himl = NULL;
|
||||
HANDLE handle;
|
||||
@@ -1726,7 +1670,7 @@ ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow,
|
||||
BITMAP bmp;
|
||||
|
||||
GetIconInfo (handle, &ii);
|
||||
GetObjectW (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp);
|
||||
GetObjectW (ii.hbmColor, sizeof(BITMAP), (LPVOID)&bmp);
|
||||
himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
|
||||
ILC_MASK | ILC_COLOR, 1, cGrow);
|
||||
if (!himl) {
|
||||
|
@@ -6276,7 +6276,7 @@ static BOOL LISTVIEW_SetBkColor(LISTVIEW_INFO *infoPtr, COLORREF clrBk)
|
||||
if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush);
|
||||
infoPtr->clrBk = clrBk;
|
||||
if (clrBk == CLR_NONE)
|
||||
infoPtr->hBkBrush = (HBRUSH)GetClassLongW(infoPtr->hwndSelf, GCL_HBRBACKGROUND);
|
||||
infoPtr->hBkBrush = (HBRUSH)GetClassLongPtrW(infoPtr->hwndSelf, GCLP_HBRBACKGROUND);
|
||||
else
|
||||
infoPtr->hBkBrush = CreateSolidBrush(clrBk);
|
||||
LISTVIEW_InvalidateList(infoPtr);
|
||||
@@ -8253,6 +8253,7 @@ static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADE
|
||||
|
||||
lpColumnInfo->rcHeader.right += dx;
|
||||
LISTVIEW_ScrollColumns(infoPtr, lpnmh->iItem + 1, dx);
|
||||
LISTVIEW_UpdateItemSize(infoPtr);
|
||||
if (uView == LVS_REPORT && is_redrawing(infoPtr))
|
||||
{
|
||||
/* this trick works for left aligned columns only */
|
||||
|
@@ -134,7 +134,7 @@ typedef struct
|
||||
|
||||
SIZE offChild; /* x,y offset if child is not FIXEDSIZE */
|
||||
UINT uMinHeight;
|
||||
INT iRow; /* row this band assigned to */
|
||||
INT iRow; /* zero-based index of the row this band assigned to */
|
||||
UINT fStatus; /* status flags, reset only by _Validate */
|
||||
UINT fDraw; /* drawing flags, reset only by _Layout */
|
||||
UINT uCDret; /* last return from NM_CUSTOMDRAW */
|
||||
@@ -360,8 +360,14 @@ static VOID
|
||||
REBAR_DumpBandInfo( LPREBARBANDINFOA pB)
|
||||
{
|
||||
if( !TRACE_ON(rebar) ) return;
|
||||
TRACE("band info: ID=%u, size=%u, child=%p, clrF=0x%06lx, clrB=0x%06lx\n",
|
||||
pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack);
|
||||
TRACE("band info: ");
|
||||
if (pB->fMask & RBBIM_ID);
|
||||
TRACE("ID=%u, ", pB->wID);
|
||||
TRACE("size=%u, child=%p", pB->cbSize, pB->hwndChild);
|
||||
if (pB->fMask & RBBIM_COLORS)
|
||||
TRACE(", clrF=0x%06lx, clrB=0x%06lx", pB->clrFore, pB->clrBack);
|
||||
TRACE("\n");
|
||||
|
||||
TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(pB->fMask));
|
||||
if (pB->fMask & RBBIM_STYLE)
|
||||
TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle));
|
||||
@@ -403,8 +409,14 @@ REBAR_DumpBand (REBAR_INFO *iP)
|
||||
(iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE");
|
||||
for (i = 0; i < iP->uNumBands; i++) {
|
||||
pB = &iP->bands[i];
|
||||
TRACE("band # %u: ID=%u, child=%p, row=%u, clrF=0x%06lx, clrB=0x%06lx\n",
|
||||
i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack);
|
||||
TRACE("band # %u:", i);
|
||||
if (pB->fMask & RBBIM_ID);
|
||||
TRACE(" ID=%u", pB->wID);
|
||||
if (pB->fMask & RBBIM_CHILD)
|
||||
TRACE(" child=%p", pB->hwndChild);
|
||||
if (pB->fMask & RBBIM_COLORS)
|
||||
TRACE(" clrF=0x%06lx clrB=0x%06lx", pB->clrFore, pB->clrBack);
|
||||
TRACE("\n");
|
||||
TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask));
|
||||
if (pB->fMask & RBBIM_STYLE)
|
||||
TRACE("band # %u: style=0x%08x (%s)\n",
|
||||
@@ -1419,7 +1431,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
|
||||
clientcx, clientcy, adjcx, adjcy);
|
||||
x = initx;
|
||||
y = inity;
|
||||
row = 1;
|
||||
row = 0;
|
||||
cx = 0;
|
||||
mcy = 0;
|
||||
rowstart = 0;
|
||||
@@ -1560,7 +1572,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
|
||||
}
|
||||
|
||||
if (infoPtr->uNumBands)
|
||||
infoPtr->uNumRows = row;
|
||||
infoPtr->uNumRows = row + 1;
|
||||
|
||||
/* ******* End Phase 1 - all bands on row at minimum size ******* */
|
||||
|
||||
@@ -1583,7 +1595,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
|
||||
|
||||
/* now adjust all rectangles by using the height found above */
|
||||
xy = 0;
|
||||
row = 1;
|
||||
row = 0;
|
||||
for (i=0; i<infoPtr->uNumBands; i++) {
|
||||
lpBand = &infoPtr->bands[i];
|
||||
if (HIDDENBAND(lpBand)) continue;
|
||||
@@ -1759,6 +1771,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
|
||||
if( !(lpBand->fDraw&DRAW_LAST_IN_ROW) )
|
||||
continue;
|
||||
|
||||
/* FIXME: this next line is wrong, but fixing it to be inverted causes IE's sidebars to be the wrong size */
|
||||
if (lpBand->fMask & RBBS_VARIABLEHEIGHT) continue;
|
||||
if (((INT)lpBand->cyMaxChild < 1) ||
|
||||
((INT)lpBand->cyIntegral < 1)) {
|
||||
@@ -1943,7 +1956,7 @@ REBAR_ValidateBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
|
||||
infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
|
||||
|
||||
/* Header is where the image, text and gripper exist */
|
||||
/* in the band and preceed the child window. */
|
||||
/* in the band and precede the child window. */
|
||||
|
||||
/* count number of non-FIXEDSIZE and non-Hidden bands */
|
||||
nonfixed = 0;
|
||||
|
@@ -79,6 +79,9 @@ typedef struct
|
||||
BOOL NtfUnicode; /* notify format */
|
||||
STATUSWINDOWPART part0; /* simple window */
|
||||
STATUSWINDOWPART* parts;
|
||||
INT horizontalBorder;
|
||||
INT verticalBorder;
|
||||
INT horizontalGap;
|
||||
} STATUS_INFO;
|
||||
|
||||
/*
|
||||
@@ -159,28 +162,24 @@ STATUSBAR_DrawPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int i
|
||||
|
||||
DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST);
|
||||
|
||||
if (part->style & SBT_OWNERDRAW)
|
||||
{
|
||||
DRAWITEMSTRUCT dis;
|
||||
if (part->style & SBT_OWNERDRAW) {
|
||||
DRAWITEMSTRUCT dis;
|
||||
|
||||
dis.CtlID = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
|
||||
dis.itemID = itemID;
|
||||
dis.hwndItem = infoPtr->Self;
|
||||
dis.hDC = hdc;
|
||||
dis.rcItem = r;
|
||||
dis.itemData = (INT)part->text;
|
||||
SendMessageW (infoPtr->Notify, WM_DRAWITEM, (WPARAM)dis.CtlID, (LPARAM)&dis);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (part->hIcon)
|
||||
{
|
||||
INT cy = r.bottom - r.top;
|
||||
dis.CtlID = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
|
||||
dis.itemID = itemID;
|
||||
dis.hwndItem = infoPtr->Self;
|
||||
dis.hDC = hdc;
|
||||
dis.rcItem = r;
|
||||
dis.itemData = (INT)part->text;
|
||||
SendMessageW (infoPtr->Notify, WM_DRAWITEM, (WPARAM)dis.CtlID, (LPARAM)&dis);
|
||||
} else {
|
||||
if (part->hIcon) {
|
||||
INT cy = r.bottom - r.top;
|
||||
|
||||
r.left += 2;
|
||||
DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
|
||||
r.left += cy;
|
||||
}
|
||||
r.left += 2;
|
||||
DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
|
||||
r.left += cy;
|
||||
}
|
||||
DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
|
||||
}
|
||||
}
|
||||
@@ -213,12 +212,11 @@ STATUSBAR_RefreshPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, in
|
||||
if (infoPtr->clrBk != CLR_DEFAULT)
|
||||
DeleteObject (hbrBk);
|
||||
|
||||
if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)
|
||||
{
|
||||
RECT rect;
|
||||
if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
|
||||
RECT rect;
|
||||
|
||||
GetClientRect (infoPtr->Self, &rect);
|
||||
STATUSBAR_DrawSizeGrip (hdc, &rect);
|
||||
GetClientRect (infoPtr->Self, &rect);
|
||||
STATUSBAR_DrawSizeGrip (hdc, &rect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,19 +238,19 @@ STATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc)
|
||||
GetClientRect (infoPtr->Self, &rect);
|
||||
|
||||
if (infoPtr->clrBk != CLR_DEFAULT)
|
||||
hbrBk = CreateSolidBrush (infoPtr->clrBk);
|
||||
hbrBk = CreateSolidBrush (infoPtr->clrBk);
|
||||
else
|
||||
hbrBk = GetSysColorBrush (COLOR_3DFACE);
|
||||
hbrBk = GetSysColorBrush (COLOR_3DFACE);
|
||||
FillRect(hdc, &rect, hbrBk);
|
||||
|
||||
hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
|
||||
|
||||
if (infoPtr->simple) {
|
||||
STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
|
||||
STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
|
||||
} else {
|
||||
for (i = 0; i < infoPtr->numParts; i++) {
|
||||
STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
|
||||
}
|
||||
for (i = 0; i < infoPtr->numParts; i++) {
|
||||
STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
SelectObject (hdc, hOldFont);
|
||||
@@ -278,7 +276,8 @@ STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr)
|
||||
GetClientRect (infoPtr->Self, &rect);
|
||||
TRACE("client wnd size is %ld,%ld - %ld,%ld\n", rect.left, rect.top, rect.right, rect.bottom);
|
||||
|
||||
rect.top += VERT_BORDER;
|
||||
rect.left += infoPtr->horizontalBorder;
|
||||
rect.top += infoPtr->verticalBorder;
|
||||
|
||||
/* set bounds for simple rectangle */
|
||||
infoPtr->part0.bound = rect;
|
||||
@@ -292,7 +291,7 @@ STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr)
|
||||
if (i == 0)
|
||||
r->left = 0;
|
||||
else
|
||||
r->left = infoPtr->parts[i-1].bound.right + HORZ_GAP;
|
||||
r->left = infoPtr->parts[i-1].bound.right + infoPtr->horizontalGap;
|
||||
if (part->x == -1)
|
||||
r->right = rect.right;
|
||||
else
|
||||
@@ -331,12 +330,25 @@ STATUSBAR_Relay2Tip (STATUS_INFO *infoPtr, UINT uMsg,
|
||||
|
||||
|
||||
static BOOL
|
||||
STATUSBAR_GetBorders (INT out[])
|
||||
STATUSBAR_GetBorders (STATUS_INFO *infoPtr, INT out[])
|
||||
{
|
||||
TRACE("\n");
|
||||
out[0] = HORZ_BORDER; /* horizontal border width */
|
||||
out[1] = VERT_BORDER; /* vertical border width */
|
||||
out[2] = HORZ_GAP; /* width of border between rectangles */
|
||||
out[0] = infoPtr->horizontalBorder;
|
||||
out[1] = infoPtr->verticalBorder;
|
||||
out[2] = infoPtr->horizontalGap;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
STATUSBAR_SetBorders (STATUS_INFO *infoPtr, INT in[])
|
||||
{
|
||||
TRACE("\n");
|
||||
infoPtr->horizontalBorder = in[0];
|
||||
infoPtr->verticalBorder = in[1];
|
||||
infoPtr->horizontalGap = in[2];
|
||||
InvalidateRect(infoPtr->Self, NULL, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -560,13 +572,13 @@ STATUSBAR_SetMinHeight (STATUS_INFO *infoPtr, INT height)
|
||||
RECT parent_rect;
|
||||
|
||||
GetClientRect (infoPtr->Notify, &parent_rect);
|
||||
infoPtr->height = height + VERT_BORDER;
|
||||
infoPtr->height = height + infoPtr->verticalBorder;
|
||||
width = parent_rect.right - parent_rect.left;
|
||||
x = parent_rect.left;
|
||||
y = parent_rect.bottom - infoPtr->height;
|
||||
MoveWindow (infoPtr->Self, parent_rect.left,
|
||||
parent_rect.bottom - infoPtr->height,
|
||||
width, infoPtr->height, TRUE);
|
||||
parent_rect.bottom - infoPtr->height,
|
||||
width, infoPtr->height, TRUE);
|
||||
STATUSBAR_SetPartBounds (infoPtr);
|
||||
}
|
||||
|
||||
@@ -728,8 +740,7 @@ STATUSBAR_SetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR text)
|
||||
ti.uId = id;
|
||||
ti.hinst = 0;
|
||||
ti.lpszText = text;
|
||||
SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA,
|
||||
0, (LPARAM)&ti);
|
||||
SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA, 0, (LPARAM)&ti);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -747,8 +758,7 @@ STATUSBAR_SetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR text)
|
||||
ti.uId = id;
|
||||
ti.hinst = 0;
|
||||
ti.lpszText = text;
|
||||
SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW,
|
||||
0, (LPARAM)&ti);
|
||||
SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -838,6 +848,9 @@ STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
|
||||
infoPtr->simple = FALSE;
|
||||
infoPtr->clrBk = CLR_DEFAULT;
|
||||
infoPtr->hFont = 0;
|
||||
infoPtr->horizontalBorder = HORZ_BORDER;
|
||||
infoPtr->verticalBorder = VERT_BORDER;
|
||||
infoPtr->horizontalGap = HORZ_GAP;
|
||||
|
||||
i = SendMessageW(infoPtr->Notify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
|
||||
infoPtr->NtfUnicode = (i == NFR_UNICODE);
|
||||
@@ -929,7 +942,7 @@ STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
|
||||
if (!(dwStyle & CCS_NORESIZE)) { /* don't resize wnd if it doesn't want it ! */
|
||||
GetClientRect (infoPtr->Notify, &rect);
|
||||
width = rect.right - rect.left;
|
||||
infoPtr->height = textHeight + 4 + VERT_BORDER;
|
||||
infoPtr->height = textHeight + 4 + infoPtr->verticalBorder;
|
||||
SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1,
|
||||
width, infoPtr->height, SWP_NOZORDER);
|
||||
STATUSBAR_SetPartBounds (infoPtr);
|
||||
@@ -1069,8 +1082,7 @@ STATUSBAR_WMSize (STATUS_INFO *infoPtr, WORD flags)
|
||||
/* Need to resize width to match parent */
|
||||
TRACE("flags %04x\n", flags);
|
||||
|
||||
if (flags != SIZE_RESTORED && flags != SIZE_MAXIMIZED)
|
||||
{
|
||||
if (flags != SIZE_RESTORED && flags != SIZE_MAXIMIZED) {
|
||||
WARN("flags MUST be SIZE_RESTORED or SIZE_MAXIMIZED\n");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1129,7 +1141,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
switch (msg) {
|
||||
case SB_GETBORDERS:
|
||||
return STATUSBAR_GetBorders ((INT *)lParam);
|
||||
return STATUSBAR_GetBorders (infoPtr, (INT *)lParam);
|
||||
|
||||
case SB_GETICON:
|
||||
return (LRESULT)STATUSBAR_GetIcon (infoPtr, nPart);
|
||||
@@ -1162,6 +1174,9 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
case SB_ISSIMPLE:
|
||||
return infoPtr->simple;
|
||||
|
||||
case SB_SETBORDERS:
|
||||
return STATUSBAR_SetBorders (infoPtr, (INT *)lParam);
|
||||
|
||||
case SB_SETBKCOLOR:
|
||||
return STATUSBAR_SetBkColor (infoPtr, (COLORREF)lParam);
|
||||
|
||||
|
@@ -421,7 +421,7 @@ INT WINAPI StrCmpNW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
|
||||
/**************************************************************************
|
||||
* StrRChrA [COMCTL32.351]
|
||||
*
|
||||
* Find the last occurence of a character in string.
|
||||
* Find the last occurrence of a character in string.
|
||||
*
|
||||
* PARAMS
|
||||
* lpszStr [I] String to search in
|
||||
@@ -572,7 +572,7 @@ LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
|
||||
/*************************************************************************
|
||||
* StrRStrIA [COMCTL32.372]
|
||||
*
|
||||
* Find the last occurence of a substring within a string.
|
||||
* Find the last occurrence of a substring within a string.
|
||||
*
|
||||
* PARAMS
|
||||
* lpszStr [I] String to search in
|
||||
@@ -580,7 +580,7 @@ LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
|
||||
* lpszSearch [I] String to look for
|
||||
*
|
||||
* RETURNS
|
||||
* The last occurence lpszSearch within lpszStr, or NULL if not found.
|
||||
* The last occurrence lpszSearch within lpszStr, or NULL if not found.
|
||||
*/
|
||||
LPSTR WINAPI StrRStrIA(LPCSTR lpszStr, LPCSTR lpszEnd, LPCSTR lpszSearch)
|
||||
{
|
||||
@@ -709,7 +709,7 @@ int WINAPI StrCSpnIW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
|
||||
/**************************************************************************
|
||||
* StrRChrIA [COMCTL32.368]
|
||||
*
|
||||
* Find the last occurence of a character in string, ignoring case.
|
||||
* Find the last occurrence of a character in string, ignoring case.
|
||||
*
|
||||
* PARAMS
|
||||
* lpszStr [I] String to search in
|
||||
|
@@ -513,7 +513,7 @@ static VOID SYSLINK_RepaintLink (SYSLINK_INFO *infoPtr, PDOC_ITEM DocItem)
|
||||
|
||||
/***********************************************************************
|
||||
* SYSLINK_GetLinkItemByIndex
|
||||
* Retreives a document link by it's index
|
||||
* Retrieves a document link by its index
|
||||
*/
|
||||
static PDOC_ITEM SYSLINK_GetLinkItemByIndex (SYSLINK_INFO *infoPtr, int iLink)
|
||||
{
|
||||
@@ -532,7 +532,7 @@ static PDOC_ITEM SYSLINK_GetLinkItemByIndex (SYSLINK_INFO *infoPtr, int iLink)
|
||||
|
||||
/***********************************************************************
|
||||
* SYSLINK_GetFocusLink
|
||||
* Retreives the link that has the LIS_FOCUSED bit
|
||||
* Retrieves the link that has the LIS_FOCUSED bit
|
||||
*/
|
||||
static PDOC_ITEM SYSLINK_GetFocusLink (SYSLINK_INFO *infoPtr, int *LinkId)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -2386,7 +2386,9 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
|
||||
|
||||
/* The custom draw handler can query the text rectangle,
|
||||
* so get ready. */
|
||||
TREEVIEW_ComputeTextWidth(infoPtr, wineItem, hdc);
|
||||
/* should already be known, set to 0 when changed */
|
||||
if (!wineItem->textWidth)
|
||||
TREEVIEW_ComputeTextWidth(infoPtr, wineItem, hdc);
|
||||
|
||||
cditem = 0;
|
||||
|
||||
@@ -3084,6 +3086,9 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
|
||||
{
|
||||
UINT action = TVE_COLLAPSE | (bRemoveChildren ? TVE_COLLAPSERESET : 0);
|
||||
BOOL bSetSelection, bSetFirstVisible;
|
||||
RECT scrollRect;
|
||||
LONG scrollDist = 0;
|
||||
TREEVIEW_ITEM *nextItem = NULL, *tmpItem;
|
||||
|
||||
TRACE("TVE_COLLAPSE %p %s\n", wineItem, TREEVIEW_ItemName(wineItem));
|
||||
|
||||
@@ -3107,6 +3112,20 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
|
||||
bSetFirstVisible = (infoPtr->firstVisible != NULL
|
||||
&& TREEVIEW_IsChildOf(wineItem, infoPtr->firstVisible));
|
||||
|
||||
tmpItem = wineItem;
|
||||
while (tmpItem)
|
||||
{
|
||||
if (tmpItem->nextSibling)
|
||||
{
|
||||
nextItem = tmpItem->nextSibling;
|
||||
break;
|
||||
}
|
||||
tmpItem = tmpItem->parent;
|
||||
}
|
||||
|
||||
if (nextItem)
|
||||
scrollDist = nextItem->rect.top;
|
||||
|
||||
if (bRemoveChildren)
|
||||
{
|
||||
INT old_cChildren = wineItem->cChildren;
|
||||
@@ -3131,8 +3150,8 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
|
||||
|
||||
TREEVIEW_RecalculateVisibleOrder(infoPtr, wineItem);
|
||||
|
||||
TREEVIEW_SetFirstVisible(infoPtr, bSetFirstVisible ? wineItem
|
||||
: infoPtr->firstVisible, TRUE);
|
||||
if (nextItem)
|
||||
scrollDist = -(scrollDist - nextItem->rect.top);
|
||||
|
||||
if (bSetSelection)
|
||||
{
|
||||
@@ -3141,12 +3160,29 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
|
||||
infoPtr->selectedItem->state &= ~TVIS_SELECTED;
|
||||
wineItem->state |= TVIS_SELECTED;
|
||||
infoPtr->selectedItem = wineItem;
|
||||
|
||||
TREEVIEW_EnsureVisible(infoPtr, wineItem, FALSE);
|
||||
}
|
||||
|
||||
TREEVIEW_UpdateScrollBars(infoPtr);
|
||||
TREEVIEW_Invalidate(infoPtr, NULL);
|
||||
|
||||
scrollRect.left = 0;
|
||||
scrollRect.right = infoPtr->clientWidth;
|
||||
scrollRect.bottom = infoPtr->clientHeight;
|
||||
|
||||
if (nextItem)
|
||||
{
|
||||
scrollRect.top = nextItem->rect.top;
|
||||
|
||||
ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, NULL,
|
||||
NULL, NULL, SW_ERASE | SW_INVALIDATE);
|
||||
TREEVIEW_Invalidate(infoPtr, wineItem);
|
||||
} else {
|
||||
scrollRect.top = wineItem->rect.top;
|
||||
InvalidateRect(infoPtr->hwnd, &scrollRect, TRUE);
|
||||
}
|
||||
|
||||
TREEVIEW_SetFirstVisible(infoPtr,
|
||||
bSetFirstVisible ? wineItem : infoPtr->firstVisible,
|
||||
TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -3155,11 +3191,30 @@ static BOOL
|
||||
TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
|
||||
BOOL bExpandPartial, BOOL bUser)
|
||||
{
|
||||
LONG scrollDist;
|
||||
LONG orgNextTop = 0;
|
||||
RECT scrollRect;
|
||||
TREEVIEW_ITEM *nextItem, *tmpItem;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (wineItem->state & TVIS_EXPANDED)
|
||||
return TRUE;
|
||||
|
||||
tmpItem = wineItem; nextItem = NULL;
|
||||
while (tmpItem)
|
||||
{
|
||||
if (tmpItem->nextSibling)
|
||||
{
|
||||
nextItem = tmpItem->nextSibling;
|
||||
break;
|
||||
}
|
||||
tmpItem = tmpItem->parent;
|
||||
}
|
||||
|
||||
if (nextItem)
|
||||
orgNextTop = nextItem->rect.top;
|
||||
|
||||
TRACE("TVE_EXPAND %p %s\n", wineItem, TREEVIEW_ItemName(wineItem));
|
||||
|
||||
if (bUser || ((wineItem->cChildren != 0) &&
|
||||
@@ -3194,6 +3249,22 @@ TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
|
||||
TREEVIEW_UpdateSubTree(infoPtr, wineItem);
|
||||
TREEVIEW_UpdateScrollBars(infoPtr);
|
||||
|
||||
scrollRect.left = 0;
|
||||
scrollRect.bottom = infoPtr->treeHeight;
|
||||
scrollRect.right = infoPtr->clientWidth;
|
||||
if (nextItem)
|
||||
{
|
||||
scrollDist = nextItem->rect.top - orgNextTop;
|
||||
scrollRect.top = orgNextTop;
|
||||
|
||||
ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, NULL,
|
||||
NULL, NULL, SW_ERASE | SW_INVALIDATE);
|
||||
TREEVIEW_Invalidate (infoPtr, wineItem);
|
||||
} else {
|
||||
scrollRect.top = wineItem->rect.top;
|
||||
InvalidateRect(infoPtr->hwnd, &scrollRect, FALSE);
|
||||
}
|
||||
|
||||
/* Scroll up so that as many children as possible are visible.
|
||||
* This fails when expanding causes an HScroll bar to appear, but we
|
||||
* don't know that yet, so the last item is obscured. */
|
||||
@@ -3226,8 +3297,6 @@ TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
|
||||
}
|
||||
}
|
||||
|
||||
TREEVIEW_Invalidate(infoPtr, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -4735,7 +4804,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
|
||||
infoPtr->uIndent = MINIMUM_INDENT;
|
||||
infoPtr->selectedItem = 0;
|
||||
infoPtr->focusedItem = 0;
|
||||
/* hotItem? */
|
||||
infoPtr->hotItem = 0;
|
||||
infoPtr->firstVisible = 0;
|
||||
infoPtr->maxVisibleOrder = 0;
|
||||
infoPtr->dropItem = 0;
|
||||
@@ -5435,7 +5504,10 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
return TREEVIEW_MouseLeave(infoPtr);
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
return TREEVIEW_MouseMove(infoPtr, wParam, lParam);
|
||||
if (infoPtr->dwStyle & TVS_TRACKSELECT)
|
||||
return TREEVIEW_MouseMove(infoPtr, wParam, lParam);
|
||||
else
|
||||
return 0;
|
||||
|
||||
case WM_NOTIFY:
|
||||
return TREEVIEW_Notify(infoPtr, wParam, lParam);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user