mirror of
https://github.com/reactos/reactos
synced 2025-10-07 08:52:45 +02:00
Compare commits
317 Commits
backups/al
...
backups/pn
Author | SHA1 | Date | |
---|---|---|---|
|
fa64e59142 | ||
|
eec0877568 | ||
|
24a420afcf | ||
|
cb6b20b96e | ||
|
614603eeb9 | ||
|
fdd9078191 | ||
|
00018abc54 | ||
|
f51f04e53e | ||
|
554ba464bc | ||
|
f14bd21382 | ||
|
2cf86ba40d | ||
|
63fa5da683 | ||
|
8ac9a09484 | ||
|
71cda6ad2a | ||
|
e11896f814 | ||
|
2b55bc2731 | ||
|
a106e5c2e0 | ||
|
0341276444 | ||
|
bb8e4bcd9e | ||
|
79d1ef572c | ||
|
97ae5f94b5 | ||
|
0ecfffa8a0 | ||
|
632a47580b | ||
|
974ee62e85 | ||
|
7889b35088 | ||
|
b929be435f | ||
|
2a60fd0675 | ||
|
1821eebb12 | ||
|
8e6267fd39 | ||
|
58042e8e21 | ||
|
64574d47b1 | ||
|
c75445a9d4 | ||
|
59904f6ca5 | ||
|
7a236ead2e | ||
|
8d780ebc45 | ||
|
c0b7a5108d | ||
|
2700763b70 | ||
|
efa9275d99 | ||
|
ef30b93924 | ||
|
a642687b55 | ||
|
fe8ad2a13b | ||
|
9cc07a82a9 | ||
|
725a3c2f57 | ||
|
8c984877c4 | ||
|
49b1d66ec3 | ||
|
561b4db8e9 | ||
|
4dcc066ed7 | ||
|
0ac49e9d42 | ||
|
160084df80 | ||
|
28a24e8079 | ||
|
e5d49d1493 | ||
|
07647a0b62 | ||
|
fd19aa00e6 | ||
|
2315100314 | ||
|
3a6ab460dd | ||
|
b1367292b1 | ||
|
a90ec8327c | ||
|
8b0ad6b22f | ||
|
a9c2167a20 | ||
|
17a549a975 | ||
|
86a52339fb | ||
|
b718e3cc4e | ||
|
a0da8855ea | ||
|
b407470ef1 | ||
|
34484a48d9 | ||
|
0f4cfdb301 | ||
|
b4d371d7d2 | ||
|
e8ecbebd7d | ||
|
0936234d7d | ||
|
124f38a790 | ||
|
de75c774c3 | ||
|
08482c30b1 | ||
|
bab510233f | ||
|
de138c3bb4 | ||
|
8b9646ca2a | ||
|
fb157f301a | ||
|
d73103f0f2 | ||
|
2d8afa8978 | ||
|
439e6fd789 | ||
|
05bc884b35 | ||
|
abb9dfec3b | ||
|
fcc7d2acc7 | ||
|
4cae592ec2 | ||
|
b0fb19733c | ||
|
0e847f36a6 | ||
|
a98111e50f | ||
|
f0e4451f31 | ||
|
572aa1faf4 | ||
|
c29c8b9124 | ||
|
621ded7636 | ||
|
e7f2044681 | ||
|
8b29e58251 | ||
|
edda3944bc | ||
|
1e7a5224aa | ||
|
db3d786f03 | ||
|
8da44c3750 | ||
|
a04bad112d | ||
|
396ff5690c | ||
|
52a70e745d | ||
|
6c8fad94ac | ||
|
6f3c732b92 | ||
|
9cb33ba90d | ||
|
dd212d63c9 | ||
|
ee054cd0f4 | ||
|
1ca3f8ce13 | ||
|
229fed0315 | ||
|
e24c42bb6b | ||
|
cf95dc8b1b | ||
|
0692378689 | ||
|
c2a04f5107 | ||
|
e54de54618 | ||
|
8b3af26269 | ||
|
e389f0c999 | ||
|
0412c84cea | ||
|
a5b6da0234 | ||
|
846dc1aebe | ||
|
f0bec76acd | ||
|
64944b49f7 | ||
|
301637bbde | ||
|
08da4a07b0 | ||
|
343e3f7bdc | ||
|
c2c6049107 | ||
|
eb54434d27 | ||
|
604f4f13c1 | ||
|
59c145b801 | ||
|
e52a450d86 | ||
|
b4e1db6c92 | ||
|
e995509c26 | ||
|
b8419654bd | ||
|
310a5bcfb7 | ||
|
a384c6e670 | ||
|
02755a61f0 | ||
|
eabbaacd53 | ||
|
fc4c441263 | ||
|
100f53e3ab | ||
|
a392c38668 | ||
|
f60f345d30 | ||
|
643a182dd0 | ||
|
cd4a8585a8 | ||
|
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 |
@@ -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'
|
||||
} */
|
@@ -21,7 +21,7 @@
|
||||
* Limitations:
|
||||
* - No support for compressed files.
|
||||
* - No attribute list support.
|
||||
* - May crash on currupted filesystem.
|
||||
* - May crash on corrupted filesystem.
|
||||
*/
|
||||
|
||||
#include <freeldr.h>
|
||||
|
@@ -578,9 +578,9 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
||||
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
||||
ULONG rosPartition;
|
||||
|
||||
extern ULONG PageDirectoryStart;
|
||||
extern ULONG PageDirectoryEnd;
|
||||
extern BOOLEAN AcpiPresent;
|
||||
extern ULONG PageDirectoryStart;
|
||||
extern ULONG PageDirectoryEnd;
|
||||
extern BOOLEAN AcpiPresent;
|
||||
|
||||
//
|
||||
// Open the operating system section
|
||||
@@ -597,9 +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;
|
||||
if (AcpiPresent) LoaderBlock.Flags |= MB_INFO_FLAG_ACPI_TABLE;
|
||||
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;
|
||||
@@ -736,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
|
||||
|
@@ -257,10 +257,10 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management","Pagin
|
||||
; Subsystems
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Debug",0x00020000,""
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Kmode",0x00020000,"%SystemRoot%\system32\win32k.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00070001,50,00,6f,00,73,00,69,00,78,00,00,00,4f,00,73,00,32,00,00,00,00,00
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix","Os2"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Os2",0x00020000,"%SystemRoot%\system32\os2ss.exe"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00070001,44,00,65,00,62,00,75,00,67,00,00,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,00,00,00,00
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe"
|
||||
|
||||
; 3Com 3c905 Driver
|
||||
@@ -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
|
||||
|
@@ -13,17 +13,18 @@ ARCH := i386
|
||||
# see gcc manual for more cpu names and which cpus it can
|
||||
# be optimized for.
|
||||
#
|
||||
OARCH := pentium2
|
||||
|
||||
OARCH := i486
|
||||
|
||||
#
|
||||
# Whether to compile in the kernel debugger
|
||||
#
|
||||
KDBG := 1
|
||||
KDBG := 0
|
||||
|
||||
#
|
||||
# Whether to compile for debugging
|
||||
#
|
||||
DBG := 1
|
||||
DBG := 0
|
||||
|
||||
#
|
||||
# Whether to compile a multiprocessor or single processor version
|
||||
|
@@ -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
|
||||
|
@@ -1,103 +1,103 @@
|
||||
|
||||
|
||||
/*
|
||||
Boiler plate for irp cancelation, for irp queues you manage yourself
|
||||
-Gunnar
|
||||
*/
|
||||
|
||||
|
||||
|
||||
CancelRoutine(
|
||||
DEV_OBJ Dev,
|
||||
Irp
|
||||
)
|
||||
{
|
||||
//don't need this since we have our own sync. protecting irp cancellation
|
||||
IoReleaseCancelSpinLock(Irp->CancelIrql);
|
||||
|
||||
theLock = Irp->Tail.Overlay.DriverContext[3];
|
||||
|
||||
Lock(theLock);
|
||||
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
|
||||
Unlock(theLock);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
}
|
||||
|
||||
|
||||
QUEUE_BOLIERPLATE
|
||||
{
|
||||
Lock(theLock);
|
||||
|
||||
Irp->Tail.Overlay.DriverContext[3] = &theLock;
|
||||
|
||||
IoSetCancelRoutine(Irp, CancelRoutine);
|
||||
if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL))
|
||||
{
|
||||
/*
|
||||
Irp has already been cancelled (before we got to queue it),
|
||||
and we got to remove the cancel routine before the canceler could,
|
||||
so we cancel/complete the irp ourself.
|
||||
*/
|
||||
|
||||
Unlock(theLock);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//else were ok
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_PENDING;
|
||||
IoMarkIrpPending(Irp);
|
||||
|
||||
InsertTailList(Queue);
|
||||
|
||||
Unlock(theLock);
|
||||
|
||||
}
|
||||
|
||||
|
||||
DEQUEUE_BOILERPLATE
|
||||
{
|
||||
Lock(theLock);
|
||||
|
||||
Irp = RemoveHeadList(Queue);
|
||||
|
||||
if (!IoSetCancelRoutine(Irp, NULL))
|
||||
{
|
||||
/*
|
||||
Cancel routine WILL be called after we release the spinlock. It will try to remove
|
||||
the irp from the list and cancel/complete this irp. Since we allready removed it,
|
||||
make its ListEntry point to itself.
|
||||
*/
|
||||
|
||||
InitializeListHead(&Irp->Tail.Overlay.ListEntry);
|
||||
|
||||
Unlock(theLock);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Cancel routine will NOT be called, canceled or not.
|
||||
The Irp might have been canceled (Irp->Cancel flag set) but we don't care,
|
||||
since we are to complete this Irp now anyways.
|
||||
*/
|
||||
|
||||
Unlock(theLock);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Boiler plate for irp cancelation, for irp queues you manage yourself
|
||||
-Gunnar
|
||||
*/
|
||||
|
||||
|
||||
|
||||
CancelRoutine(
|
||||
DEV_OBJ Dev,
|
||||
Irp
|
||||
)
|
||||
{
|
||||
//don't need this since we have our own sync. protecting irp cancellation
|
||||
IoReleaseCancelSpinLock(Irp->CancelIrql);
|
||||
|
||||
theLock = Irp->Tail.Overlay.DriverContext[3];
|
||||
|
||||
Lock(theLock);
|
||||
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
|
||||
Unlock(theLock);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
}
|
||||
|
||||
|
||||
QUEUE_BOLIERPLATE
|
||||
{
|
||||
Lock(theLock);
|
||||
|
||||
Irp->Tail.Overlay.DriverContext[3] = &theLock;
|
||||
|
||||
IoSetCancelRoutine(Irp, CancelRoutine);
|
||||
if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL))
|
||||
{
|
||||
/*
|
||||
Irp has already been cancelled (before we got to queue it),
|
||||
and we got to remove the cancel routine before the canceler could,
|
||||
so we cancel/complete the irp ourself.
|
||||
*/
|
||||
|
||||
Unlock(theLock);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//else were ok
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_PENDING;
|
||||
IoMarkIrpPending(Irp);
|
||||
|
||||
InsertTailList(Queue);
|
||||
|
||||
Unlock(theLock);
|
||||
|
||||
}
|
||||
|
||||
|
||||
DEQUEUE_BOILERPLATE
|
||||
{
|
||||
Lock(theLock);
|
||||
|
||||
Irp = RemoveHeadList(Queue);
|
||||
|
||||
if (!IoSetCancelRoutine(Irp, NULL))
|
||||
{
|
||||
/*
|
||||
Cancel routine WILL be called after we release the spinlock. It will try to remove
|
||||
the irp from the list and cancel/complete this irp. Since we allready removed it,
|
||||
make its ListEntry point to itself.
|
||||
*/
|
||||
|
||||
InitializeListHead(&Irp->Tail.Overlay.ListEntry);
|
||||
|
||||
Unlock(theLock);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Cancel routine will NOT be called, canceled or not.
|
||||
The Irp might have been canceled (Irp->Cancel flag set) but we don't care,
|
||||
since we are to complete this Irp now anyways.
|
||||
*/
|
||||
|
||||
Unlock(theLock);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
}
|
||||
|
@@ -60,12 +60,7 @@ AcpiCreateDeviceIDString(PUNICODE_STRING DeviceID,
|
||||
L"ACPI\\%S",
|
||||
Node->device.id.hid);
|
||||
|
||||
if (!AcpiCreateUnicodeString(DeviceID, Buffer, PagedPool))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return AcpiCreateUnicodeString(DeviceID, Buffer, PagedPool);
|
||||
}
|
||||
|
||||
|
||||
@@ -108,8 +103,15 @@ BOOLEAN
|
||||
AcpiCreateInstanceIDString(PUNICODE_STRING InstanceID,
|
||||
BM_NODE *Node)
|
||||
{
|
||||
/* FIXME: Create unique instnce id. */
|
||||
return AcpiCreateUnicodeString(InstanceID, L"0000", PagedPool);
|
||||
WCHAR Buffer[10];
|
||||
|
||||
if (Node->device.id.uid[0])
|
||||
swprintf(Buffer, L"%S", Node->device.id.uid);
|
||||
else
|
||||
/* FIXME: Generate unique id! */
|
||||
swprintf(Buffer, L"0000");
|
||||
|
||||
return AcpiCreateUnicodeString(InstanceID, Buffer, PagedPool);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +128,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 */
|
||||
|
96
reactos/drivers/dd/serial/circularbuffer.c
Normal file
96
reactos/drivers/dd/serial/circularbuffer.c
Normal file
@@ -0,0 +1,96 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/circularbuffer.c
|
||||
* PURPOSE: Operations on a circular buffer
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS
|
||||
InitializeCircularBuffer(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN ULONG BufferSize)
|
||||
{
|
||||
DPRINT("Serial: InitializeCircularBuffer(pBuffer %p, BufferSize %lu)\n", pBuffer, BufferSize);
|
||||
pBuffer->Buffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, BufferSize * sizeof(UCHAR), SERIAL_TAG);
|
||||
if (!pBuffer->Buffer)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
pBuffer->Length = BufferSize;
|
||||
pBuffer->ReadPosition = pBuffer->WritePosition = 0;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
FreeCircularBuffer(
|
||||
IN PCIRCULAR_BUFFER pBuffer)
|
||||
{
|
||||
DPRINT("Serial: FreeCircularBuffer(pBuffer %p)\n", pBuffer);
|
||||
ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsCircularBufferEmpty(
|
||||
IN PCIRCULAR_BUFFER pBuffer)
|
||||
{
|
||||
DPRINT("Serial: IsCircularBufferEmpty(pBuffer %p)\n", pBuffer);
|
||||
return (pBuffer->ReadPosition == pBuffer->WritePosition);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
PushCircularBufferEntry(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN UCHAR Entry)
|
||||
{
|
||||
DPRINT("Serial: PushCircularBufferEntry(pBuffer %p, Entry 0x%x)\n", pBuffer, Entry);
|
||||
ASSERT(pBuffer->Length);
|
||||
ULONG NextPosition = (pBuffer->WritePosition + 1) % pBuffer->Length;
|
||||
if (NextPosition == pBuffer->ReadPosition)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
pBuffer->Buffer[pBuffer->WritePosition] = Entry;
|
||||
pBuffer->WritePosition = NextPosition;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
PopCircularBufferEntry(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
OUT PUCHAR Entry)
|
||||
{
|
||||
DPRINT("Serial: PopCircularBufferEntry(pBuffer %p)\n", pBuffer);
|
||||
ASSERT(pBuffer->Length);
|
||||
if (IsCircularBufferEmpty(pBuffer))
|
||||
return STATUS_ARRAY_BOUNDS_EXCEEDED;
|
||||
*Entry = pBuffer->Buffer[pBuffer->ReadPosition];
|
||||
pBuffer->ReadPosition = (pBuffer->ReadPosition + 1) % pBuffer->Length;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
IncreaseCircularBufferSize(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN ULONG NewBufferSize)
|
||||
{
|
||||
PUCHAR NewBuffer;
|
||||
|
||||
DPRINT("Serial: IncreaseCircularBufferSize(pBuffer %p, NewBufferSize %lu)\n", pBuffer, NewBufferSize);
|
||||
ASSERT(pBuffer->Length);
|
||||
if (pBuffer->Length > NewBufferSize)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
else if (pBuffer->Length == NewBufferSize)
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
NewBuffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, NewBufferSize * sizeof(UCHAR), SERIAL_TAG);
|
||||
if (!NewBuffer)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
RtlCopyMemory(NewBuffer, pBuffer->Buffer, pBuffer->Length * sizeof(UCHAR));
|
||||
ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG);
|
||||
pBuffer->Buffer = NewBuffer;
|
||||
pBuffer->Length = NewBufferSize;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
24
reactos/drivers/dd/serial/cleanup.c
Normal file
24
reactos/drivers/dd/serial/cleanup.c
Normal file
@@ -0,0 +1,24 @@
|
||||
/* $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");
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
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;
|
||||
}
|
730
reactos/drivers/dd/serial/devctrl.c
Normal file
730
reactos/drivers/dd/serial/devctrl.c
Normal file
@@ -0,0 +1,730 @@
|
||||
/* $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;
|
||||
ULONG BaudRate;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
if (NewBaudRate & SERIAL_BAUD_USER)
|
||||
{
|
||||
BaudRate = NewBaudRate & ~SERIAL_BAUD_USER;
|
||||
divisor = (USHORT)(BAUD_CLOCK / (CLOCKS_PER_BIT * BaudRate));
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (NewBaudRate)
|
||||
{
|
||||
case SERIAL_BAUD_075: divisor = 0x600; BaudRate = 75; break;
|
||||
case SERIAL_BAUD_110: divisor = 0x400; BaudRate = 110; break;
|
||||
case SERIAL_BAUD_134_5: divisor = 0x360; BaudRate = 134; break;
|
||||
case SERIAL_BAUD_150: divisor = 0x300; BaudRate = 150; break;
|
||||
case SERIAL_BAUD_300: divisor = 0x180; BaudRate = 300; break;
|
||||
case SERIAL_BAUD_600: divisor = 0xc0; BaudRate = 600; break;
|
||||
case SERIAL_BAUD_1200: divisor = 0x60; BaudRate = 1200; break;
|
||||
case SERIAL_BAUD_1800: divisor = 0x40; BaudRate = 1800; break;
|
||||
case SERIAL_BAUD_2400: divisor = 0x30; BaudRate = 2400; break;
|
||||
case SERIAL_BAUD_4800: divisor = 0x18; BaudRate = 4800; break;
|
||||
case SERIAL_BAUD_7200: divisor = 0x10; BaudRate = 7200; break;
|
||||
case SERIAL_BAUD_9600: divisor = 0xc; BaudRate = 9600; break;
|
||||
case SERIAL_BAUD_14400: divisor = 0x8; BaudRate = 14400; break;
|
||||
case SERIAL_BAUD_38400: divisor = 0x3; BaudRate = 38400; break;
|
||||
case SERIAL_BAUD_57600: divisor = 0x2; BaudRate = 57600; break;
|
||||
case SERIAL_BAUD_115200: divisor = 0x1; BaudRate = 115200; break;
|
||||
case SERIAL_BAUD_56K: divisor = 0x2; BaudRate = 57600; break;
|
||||
case SERIAL_BAUD_128K: divisor = 0x1; BaudRate = 115200; 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, BaudRate);
|
||||
/* Set Bit 7 of LCR to expose baud registers */
|
||||
Lcr = READ_PORT_UCHAR(SER_LCR(ComPortBase));
|
||||
WRITE_PORT_UCHAR(SER_LCR(ComPortBase), Lcr | SR_LCR_DLAB);
|
||||
/* 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 */
|
||||
WRITE_PORT_UCHAR(SER_LCR(ComPortBase), Lcr);
|
||||
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
}
|
||||
}
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
DeviceExtension->BaudRate = BaudRate;
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialSetLineControl(
|
||||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension,
|
||||
IN PSERIAL_LINE_CONTROL NewSettings)
|
||||
{
|
||||
PUCHAR ComPortBase;
|
||||
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 */
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
WRITE_PORT_UCHAR(SER_LCR(ComPortBase), Lcr);
|
||||
|
||||
/* Read junk out of RBR */
|
||||
READ_PORT_UCHAR(SER_RBR(ComPortBase));
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
DeviceExtension->SerialLineControl = *NewSettings;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
SerialClearPerfStats(
|
||||
IN PSERIALPERF_STATS pSerialPerfStats)
|
||||
{
|
||||
RtlZeroMemory(pSerialPerfStats, sizeof(SERIALPERF_STATS));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
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
|
||||
SerialGetCommProp(
|
||||
OUT PSERIAL_COMMPROP pCommProp,
|
||||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
RtlZeroMemory(pCommProp, sizeof(SERIAL_COMMPROP));
|
||||
|
||||
pCommProp->PacketLength = sizeof(SERIAL_COMMPROP);
|
||||
pCommProp->PacketVersion = 2;
|
||||
pCommProp->ServiceMask = SERIAL_SP_SERIALCOMM;
|
||||
pCommProp->MaxTxQueue = pCommProp->CurrentTxQueue = DeviceExtension->OutputBuffer.Length - 1;
|
||||
pCommProp->MaxRxQueue = pCommProp->CurrentRxQueue = DeviceExtension->InputBuffer.Length - 1;
|
||||
pCommProp->MaxBaud = SERIAL_BAUD_115200;
|
||||
pCommProp->ProvSubType = 1; // PST_RS232;
|
||||
/* FIXME: ProvCapabilities may be related to Uart type */
|
||||
pCommProp->ProvCapabilities = SERIAL_PCF_DTRDSR | SERIAL_PCF_INTTIMEOUTS | SERIAL_PCF_PARITY_CHECK
|
||||
| SERIAL_PCF_RTSCTS | SERIAL_PCF_SETXCHAR | SERIAL_PCF_SPECIALCHARS | SERIAL_PCF_TOTALTIMEOUTS
|
||||
| SERIAL_PCF_XONXOFF;
|
||||
/* FIXME: SettableParams may be related to Uart type */
|
||||
pCommProp->SettableParams = SERIAL_SP_BAUD | SERIAL_SP_DATABITS | SERIAL_SP_HANDSHAKING
|
||||
| SERIAL_SP_PARITY | SERIAL_SP_PARITY_CHECK | SERIAL_SP_STOPBITS;
|
||||
/* FIXME: SettableBaud may be related to Uart type */
|
||||
pCommProp->SettableBaud = SERIAL_BAUD_075 | SERIAL_BAUD_110 | SERIAL_BAUD_134_5
|
||||
| SERIAL_BAUD_150 | SERIAL_BAUD_300 | SERIAL_BAUD_600 | SERIAL_BAUD_1200
|
||||
| SERIAL_BAUD_1800 | SERIAL_BAUD_2400 | SERIAL_BAUD_4800 | SERIAL_BAUD_7200
|
||||
| SERIAL_BAUD_9600 | SERIAL_BAUD_14400 | SERIAL_BAUD_19200 | SERIAL_BAUD_38400
|
||||
| SERIAL_BAUD_56K | SERIAL_BAUD_57600 | SERIAL_BAUD_115200 | SERIAL_BAUD_128K
|
||||
| SERIAL_BAUD_USER;
|
||||
pCommProp->SettableData = SERIAL_DATABITS_5 | SERIAL_DATABITS_6 | SERIAL_DATABITS_7 | SERIAL_DATABITS_8;
|
||||
pCommProp->SettableStopParity = SERIAL_STOPBITS_10 | SERIAL_STOPBITS_15 | SERIAL_STOPBITS_20
|
||||
| SERIAL_PARITY_NONE | SERIAL_PARITY_ODD | SERIAL_PARITY_EVEN | SERIAL_PARITY_MARK | SERIAL_PARITY_SPACE;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
SerialGetCommStatus(
|
||||
OUT PSERIAL_STATUS pSerialStatus,
|
||||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
KIRQL Irql;
|
||||
|
||||
RtlZeroMemory(pSerialStatus, sizeof(SERIAL_STATUS));
|
||||
|
||||
pSerialStatus->Errors = 0; /* FIXME */
|
||||
pSerialStatus->HoldReasons = 0; /* FIXME */
|
||||
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
||||
pSerialStatus->AmountInInQueue = (DeviceExtension->InputBuffer.WritePosition + DeviceExtension->InputBuffer.Length
|
||||
- DeviceExtension->InputBuffer.ReadPosition) % DeviceExtension->InputBuffer.Length;
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
|
||||
pSerialStatus->AmountInOutQueue = (DeviceExtension->OutputBuffer.WritePosition + DeviceExtension->OutputBuffer.Length
|
||||
- DeviceExtension->OutputBuffer.ReadPosition) % DeviceExtension->OutputBuffer.Length;
|
||||
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
|
||||
|
||||
pSerialStatus->EofReceived = FALSE; /* FIXME */
|
||||
pSerialStatus->WaitForImmediate = FALSE; /* FIXME */
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
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");
|
||||
/* FIXME: HACK!!! following line MUST NOT be here! */
|
||||
Buffer = Irp->UserBuffer;
|
||||
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:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_COMMSTATUS\n");
|
||||
if (LengthOut < sizeof(SERIAL_STATUS))
|
||||
{
|
||||
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
|
||||
{
|
||||
Status = SerialGetCommStatus((PSERIAL_STATUS)Buffer, DeviceExtension);
|
||||
Information = sizeof(SERIAL_STATUS);
|
||||
}
|
||||
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:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_PROPERTIES\n");
|
||||
if (LengthOut < sizeof(SERIAL_COMMPROP))
|
||||
{
|
||||
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
|
||||
{
|
||||
Status = SerialGetCommProp((PSERIAL_COMMPROP)Buffer, DeviceExtension);
|
||||
Information = sizeof(SERIAL_COMMPROP);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_STATS:
|
||||
{
|
||||
DPRINT("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:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_TIMEOUTS\n");
|
||||
if (LengthOut != sizeof(SERIAL_TIMEOUTS) || Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
*(PSERIAL_TIMEOUTS)Buffer = DeviceExtension->SerialTimeOuts;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
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:
|
||||
{
|
||||
KIRQL Irql1, Irql2;
|
||||
DPRINT("Serial: IOCTL_SERIAL_PURGE\n");
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql1);
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql2);
|
||||
DeviceExtension->InputBuffer.ReadPosition = DeviceExtension->InputBuffer.WritePosition = 0;
|
||||
DeviceExtension->OutputBuffer.ReadPosition = DeviceExtension->OutputBuffer.WritePosition = 0;
|
||||
/* Clear receive/transmit buffers */
|
||||
if (DeviceExtension->UartType >= Uart16550)
|
||||
{
|
||||
WRITE_PORT_UCHAR(SER_FCR(ComPortBase),
|
||||
SR_FCR_CLEAR_RCVR | SR_FCR_CLEAR_XMIT);
|
||||
}
|
||||
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql2);
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql1);
|
||||
Status = STATUS_SUCCESS;
|
||||
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:
|
||||
{
|
||||
if (LengthIn < sizeof(SERIAL_QUEUE_SIZE ))
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
else if (Buffer == NULL)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
KIRQL Irql;
|
||||
Status = STATUS_SUCCESS;
|
||||
if (((PSERIAL_QUEUE_SIZE)Buffer)->InSize > DeviceExtension->InputBuffer.Length)
|
||||
{
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
||||
Status = IncreaseCircularBufferSize(&DeviceExtension->InputBuffer, ((PSERIAL_QUEUE_SIZE)Buffer)->InSize);
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
}
|
||||
if (NT_SUCCESS(Status) && ((PSERIAL_QUEUE_SIZE)Buffer)->OutSize > DeviceExtension->OutputBuffer.Length)
|
||||
{
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
|
||||
Status = IncreaseCircularBufferSize(&DeviceExtension->OutputBuffer, ((PSERIAL_QUEUE_SIZE)Buffer)->OutSize);
|
||||
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
|
||||
}
|
||||
}
|
||||
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:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_TIMEOUTS\n");
|
||||
if (LengthIn != sizeof(SERIAL_TIMEOUTS) || Buffer == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
DeviceExtension->SerialTimeOuts = *(PSERIAL_TIMEOUTS)Buffer;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
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;
|
||||
}
|
76
reactos/drivers/dd/serial/info.c
Normal file
76
reactos/drivers/dd/serial/info.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/* $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;
|
||||
ULONG Information = 0;
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION: Unexpected file information class 0x%02x\n", Stack->Parameters.QueryFile.FileInformationClass);
|
||||
return ForwardIrpAndForget(DeviceObject, Irp);
|
||||
}
|
||||
}
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
180
reactos/drivers/dd/serial/legacy.c
Normal file
180
reactos/drivers/dd/serial/legacy.c
Normal file
@@ -0,0 +1,180 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/bus/serial/legacy.c
|
||||
* PURPOSE: Legacy serial port enumeration
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
* Mark Junker (mjscod@gmx.de)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
UART_TYPE
|
||||
SerialDetectUartType(
|
||||
IN PUCHAR BaseAddress)
|
||||
{
|
||||
UCHAR Lcr, TestLcr;
|
||||
UCHAR OldScr, Scr5A, ScrA5;
|
||||
BOOLEAN FifoEnabled;
|
||||
UCHAR NewFifoStatus;
|
||||
|
||||
Lcr = READ_PORT_UCHAR(SER_LCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr ^ 0xFF);
|
||||
TestLcr = READ_PORT_UCHAR(SER_LCR(BaseAddress)) ^ 0xFF;
|
||||
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr);
|
||||
|
||||
/* Accessing the LCR must work for a usable serial port */
|
||||
if (TestLcr != Lcr)
|
||||
return UartUnknown;
|
||||
|
||||
/* Ensure that all following accesses are done as required */
|
||||
READ_PORT_UCHAR(SER_RBR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_IER(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_IIR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_LCR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_MCR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_LSR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_MSR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
|
||||
/* Test scratch pad */
|
||||
OldScr = READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0x5A);
|
||||
Scr5A = READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0xA5);
|
||||
ScrA5 = READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), OldScr);
|
||||
|
||||
/* When non-functional, we have a 8250 */
|
||||
if (Scr5A != 0x5A || ScrA5 != 0xA5)
|
||||
return Uart8250;
|
||||
|
||||
/* Test FIFO type */
|
||||
FifoEnabled = (READ_PORT_UCHAR(SER_IIR(BaseAddress)) & 0x80) != 0;
|
||||
WRITE_PORT_UCHAR(SER_FCR(BaseAddress), SR_FCR_ENABLE_FIFO);
|
||||
NewFifoStatus = READ_PORT_UCHAR(SER_IIR(BaseAddress)) & 0xC0;
|
||||
if (!FifoEnabled)
|
||||
WRITE_PORT_UCHAR(SER_FCR(BaseAddress), 0);
|
||||
switch (NewFifoStatus)
|
||||
{
|
||||
case 0x00:
|
||||
return Uart16450;
|
||||
case 0x80:
|
||||
return Uart16550;
|
||||
}
|
||||
|
||||
/* FIFO is only functional for 16550A+ */
|
||||
return Uart16550A;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
DetectLegacyDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN ULONG ComPortBase,
|
||||
IN ULONG Irq)
|
||||
{
|
||||
ULONG ResourceListSize;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
|
||||
BOOLEAN ConflictDetected;
|
||||
UART_TYPE UartType;
|
||||
PDEVICE_OBJECT Pdo = NULL;
|
||||
PDEVICE_OBJECT Fdo;
|
||||
KIRQL Dirql;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Create resource list */
|
||||
ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, SERIAL_TAG);
|
||||
if (!ResourceList)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
ResourceList->Count = 1;
|
||||
ResourceList->List[0].InterfaceType = Isa;
|
||||
ResourceList->List[0].BusNumber = -1; /* FIXME */
|
||||
ResourceList->List[0].PartialResourceList.Version = 1;
|
||||
ResourceList->List[0].PartialResourceList.Revision = 1;
|
||||
ResourceList->List[0].PartialResourceList.Count = 2;
|
||||
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[0];
|
||||
ResourceDescriptor->Type = CmResourceTypePort;
|
||||
ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
|
||||
ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
|
||||
ResourceDescriptor->u.Port.Start.u.HighPart = 0;
|
||||
ResourceDescriptor->u.Port.Start.u.LowPart = ComPortBase;
|
||||
ResourceDescriptor->u.Port.Length = 8;
|
||||
|
||||
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[1];
|
||||
ResourceDescriptor->Type = CmResourceTypeInterrupt;
|
||||
ResourceDescriptor->ShareDisposition = CmResourceShareShared;
|
||||
ResourceDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
|
||||
ResourceDescriptor->u.Interrupt.Vector = HalGetInterruptVector(
|
||||
Internal, 0, 0, Irq,
|
||||
&Dirql,
|
||||
&ResourceDescriptor->u.Interrupt.Affinity);
|
||||
ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
|
||||
|
||||
/* Report resource list */
|
||||
Status = IoReportResourceForDetection(
|
||||
DriverObject, ResourceList, ResourceListSize,
|
||||
NULL, NULL, 0,
|
||||
&ConflictDetected);
|
||||
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
||||
return STATUS_DEVICE_NOT_CONNECTED;
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
/* Test if port exists */
|
||||
UartType = SerialDetectUartType((PUCHAR)ComPortBase);
|
||||
|
||||
/* Report device if detected... */
|
||||
if (UartType != UartUnknown)
|
||||
{
|
||||
Status = IoReportDetectedDevice(
|
||||
DriverObject,
|
||||
ResourceList->List[0].InterfaceType, ResourceList->List[0].BusNumber, -1/*FIXME*/,
|
||||
ResourceList, NULL,
|
||||
TRUE,
|
||||
&Pdo);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = SerialAddDeviceInternal(DriverObject, Pdo, UartType, &Fdo);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = SerialPnpStartDevice(Fdo, ResourceList);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Release resources */
|
||||
Status = IoReportResourceForDetection(
|
||||
DriverObject, NULL, 0,
|
||||
NULL, NULL, 0,
|
||||
&ConflictDetected);
|
||||
Status = STATUS_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
DetectLegacyDevices(
|
||||
IN PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
ULONG ComPortBase[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
|
||||
ULONG Irq[] = { 4, 3, 4, 3 };
|
||||
ULONG i;
|
||||
NTSTATUS Status;
|
||||
NTSTATUS ReturnedStatus = STATUS_SUCCESS;
|
||||
|
||||
for (i = 0; i < sizeof(ComPortBase)/sizeof(ComPortBase[0]); i++)
|
||||
{
|
||||
Status = DetectLegacyDevice(DriverObject, ComPortBase[i], Irq[i]);
|
||||
if (!NT_SUCCESS(Status) && Status != STATUS_DEVICE_NOT_CONNECTED)
|
||||
ReturnedStatus = Status;
|
||||
DPRINT("Serial: Legacy device at 0x%x (IRQ %lu): status = 0x%08lx\n", ComPortBase[i], Irq[i], Status);
|
||||
}
|
||||
|
||||
return ReturnedStatus;
|
||||
}
|
@@ -6,7 +6,19 @@ TARGET_TYPE = driver
|
||||
|
||||
TARGET_NAME = serial
|
||||
|
||||
TARGET_OBJECTS = serial.o
|
||||
TARGET_OBJECTS = \
|
||||
circularbuffer.o \
|
||||
cleanup.o \
|
||||
close.o \
|
||||
create.o \
|
||||
devctrl.o \
|
||||
info.o \
|
||||
legacy.o \
|
||||
misc.o \
|
||||
pnp.o \
|
||||
power.o \
|
||||
rw.o \
|
||||
serial.o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API
|
||||
|
||||
|
196
reactos/drivers/dd/serial/misc.c
Normal file
196
reactos/drivers/dd/serial/misc.c
Normal file
@@ -0,0 +1,196 @@
|
||||
/* $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)
|
||||
*/
|
||||
/* FIXME: call IoAcquireRemoveLock/IoReleaseRemoveLock around each I/O operation */
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
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;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ForwardIrpAndForget(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PDEVICE_OBJECT LowerDevice = ((PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
||||
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
return IoCallDriver(LowerDevice, Irp);
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
SerialReceiveByte(
|
||||
IN PKDPC Dpc,
|
||||
IN PVOID pDeviceExtension, // real type PSERIAL_DEVICE_EXTENSION
|
||||
IN PVOID pByte, // real type UCHAR
|
||||
IN PVOID Unused)
|
||||
{
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
UCHAR Byte;
|
||||
KIRQL Irql;
|
||||
NTSTATUS Status;
|
||||
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)pDeviceExtension;
|
||||
Byte = (UCHAR)(ULONG_PTR)pByte;
|
||||
DPRINT1("Serial: received byte on COM%lu: 0x%02x (%c)\n",
|
||||
DeviceExtension->ComPort, Byte, Byte);
|
||||
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
||||
Status = PushCircularBufferEntry(&DeviceExtension->InputBuffer, Byte);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* FIXME: count buffer overflow */
|
||||
return;
|
||||
}
|
||||
DPRINT1("Serial: push to buffer done\n");
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
InterlockedIncrement(&DeviceExtension->SerialPerfStats.ReceivedCount);
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
SerialSendByte(
|
||||
IN PKDPC Dpc,
|
||||
IN PVOID pDeviceExtension, // real type PSERIAL_DEVICE_EXTENSION
|
||||
IN PVOID Unused1,
|
||||
IN PVOID Unused2)
|
||||
{
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
PUCHAR ComPortBase;
|
||||
UCHAR Byte;
|
||||
KIRQL Irql;
|
||||
NTSTATUS Status;
|
||||
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)pDeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
DPRINT1("Serial: sending bytes (if any) on COM%lu\n",
|
||||
DeviceExtension->ComPort);
|
||||
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
|
||||
while (!IsCircularBufferEmpty(&DeviceExtension->OutputBuffer)
|
||||
&& READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_TBE)
|
||||
{
|
||||
Status = PopCircularBufferEntry(&DeviceExtension->OutputBuffer, &Byte);
|
||||
if (!NT_SUCCESS(Status))
|
||||
break;
|
||||
WRITE_PORT_UCHAR(SER_THR(ComPortBase), Byte);
|
||||
DeviceExtension->SerialPerfStats.TransmittedCount++;
|
||||
}
|
||||
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
|
||||
}
|
||||
|
||||
BOOLEAN STDCALL
|
||||
SerialInterruptService(
|
||||
IN PKINTERRUPT Interrupt,
|
||||
IN OUT PVOID ServiceContext)
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
UCHAR Byte;
|
||||
PUCHAR ComPortBase;
|
||||
UCHAR Iir;
|
||||
|
||||
DeviceObject = (PDEVICE_OBJECT)ServiceContext;
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
Iir = READ_PORT_UCHAR(SER_IIR(ComPortBase));
|
||||
if (Iir == 0xff)
|
||||
return TRUE;
|
||||
Iir &= SR_IIR_ID_MASK;
|
||||
if ((Iir & SR_IIR_SELF) != 0) { return FALSE; }
|
||||
|
||||
/* FIXME: sometimes, update DeviceExtension->IER */
|
||||
/* FIXME: sometimes, update DeviceExtension->MCR */
|
||||
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 TRUE;
|
||||
}
|
||||
case SR_IIR_THR_EMPTY:
|
||||
{
|
||||
DPRINT("Serial: SR_IIR_THR_EMPTY\n");
|
||||
return KeInsertQueueDpc(&DeviceExtension->SendByteDpc, NULL, NULL);
|
||||
}
|
||||
case SR_IIR_DATA_RECEIVED:
|
||||
{
|
||||
DPRINT1("Serial: SR_IIR_DATA_RECEIVED\n");
|
||||
while (READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_DR)
|
||||
{
|
||||
Byte = READ_PORT_UCHAR(SER_RBR(ComPortBase));
|
||||
DPRINT1("Serial: Byte received: 0x%02x (%c)\n", Byte, Byte);
|
||||
if (!KeInsertQueueDpc(&DeviceExtension->ReceivedByteDpc, (PVOID)(ULONG_PTR)Byte, NULL))
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
case SR_IIR_ERROR:
|
||||
{
|
||||
/* FIXME: what to do? */
|
||||
DPRINT1("Serial: SR_IIR_ERROR\n");
|
||||
break;
|
||||
/*Error = READ_PORT_UCHAR( Self->Port + UART_LSR );
|
||||
if( Error & LSR_OVERRUN )
|
||||
Self->WaitingReadBytes.PushBack( SerialFifo::OVERRUN );
|
||||
DeviceExtension->SerialPerfStats.SerialOverrunErrorCount++;
|
||||
if( Error & LSR_PARITY_ERROR )
|
||||
Self->WaitingReadBytes.PushBack( SerialFifo::PARITY );
|
||||
DeviceExtension->SerialPerfStats.ParityErrorCount++;
|
||||
if( Error & LSR_FRAMING_ERROR )
|
||||
Self->WaitingReadBytes.PushBack( SerialFifo::FRAMING );
|
||||
DeviceExtension->SerialPerfStats.FrameErrorCount++;
|
||||
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;
|
||||
}
|
351
reactos/drivers/dd/serial/pnp.c
Normal file
351
reactos/drivers/dd/serial/pnp.c
Normal file
@@ -0,0 +1,351 @@
|
||||
/* $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 INITGUID
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialAddDeviceInternal(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT Pdo,
|
||||
IN UART_TYPE UartType,
|
||||
OUT PDEVICE_OBJECT* pFdo OPTIONAL)
|
||||
{
|
||||
PDEVICE_OBJECT Fdo = NULL;
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension = NULL;
|
||||
NTSTATUS Status;
|
||||
WCHAR DeviceNameBuffer[32];
|
||||
UNICODE_STRING DeviceName;
|
||||
//UNICODE_STRING SymbolicLinkName;
|
||||
static ULONG DeviceNumber = 0;
|
||||
|
||||
DPRINT("Serial: SerialAddDeviceInternal 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);
|
||||
Fdo = NULL;
|
||||
goto ByeBye;
|
||||
}
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(SERIAL_DEVICE_EXTENSION));
|
||||
|
||||
/* Register device interface */
|
||||
#if 0 /* FIXME: activate */
|
||||
Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_COMPORT, NULL, &SymbolicLinkName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: IoRegisterDeviceInterface() failed with status 0x%08x\n", Status);
|
||||
goto ByeBye;
|
||||
}
|
||||
DPRINT1("Serial: IoRegisterDeviceInterface() returned '%wZ'\n", &SymbolicLinkName);
|
||||
Status = IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: IoSetDeviceInterfaceState() failed with status 0x%08x\n", Status);
|
||||
goto ByeBye;
|
||||
}
|
||||
RtlFreeUnicodeString(&SymbolicLinkName);
|
||||
#endif
|
||||
|
||||
DeviceExtension->SerialPortNumber = DeviceNumber++;
|
||||
DeviceExtension->Pdo = Pdo;
|
||||
DeviceExtension->PnpState = dsStopped;
|
||||
DeviceExtension->UartType = UartType;
|
||||
Status = InitializeCircularBuffer(&DeviceExtension->InputBuffer, 16);
|
||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||
Status = InitializeCircularBuffer(&DeviceExtension->OutputBuffer, 16);
|
||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||
IoInitializeRemoveLock(&DeviceExtension->RemoveLock, SERIAL_TAG, 0, 0);
|
||||
KeInitializeSpinLock(&DeviceExtension->InputBufferLock);
|
||||
KeInitializeSpinLock(&DeviceExtension->OutputBufferLock);
|
||||
KeInitializeDpc(&DeviceExtension->ReceivedByteDpc, SerialReceiveByte, DeviceExtension);
|
||||
KeInitializeDpc(&DeviceExtension->SendByteDpc, SerialSendByte, DeviceExtension);
|
||||
//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);
|
||||
goto ByeBye;
|
||||
}
|
||||
Fdo->Flags |= DO_BUFFERED_IO;
|
||||
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
if (pFdo)
|
||||
{
|
||||
*pFdo = Fdo;
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
ByeBye:
|
||||
if (Fdo)
|
||||
{
|
||||
FreeCircularBuffer(&DeviceExtension->InputBuffer);
|
||||
FreeCircularBuffer(&DeviceExtension->OutputBuffer);
|
||||
IoDeleteDevice(Fdo);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialAddDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT Pdo)
|
||||
{
|
||||
/* Serial.sys is a legacy driver. AddDevice is called once
|
||||
* with a NULL Pdo just after the driver initialization.
|
||||
* Detect this case and return success.
|
||||
*/
|
||||
if (Pdo == NULL)
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
/* We have here a PDO that does not correspond to a legacy
|
||||
* serial port. So call the internal AddDevice function.
|
||||
*/
|
||||
DPRINT1("Serial: SerialAddDevice() called. Pdo 0x%p (should be NULL)\n", Pdo);
|
||||
/* FIXME: due to a bug, previously described AddDevice is
|
||||
* not called with a NULL Pdo. Block this call (blocks
|
||||
* unfortunately all the other PnP serial ports devices).
|
||||
*/
|
||||
//return SerialAddDeviceInternal(DriverObject, Pdo, UartUnknown, NULL);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialPnpStartDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PCM_RESOURCE_LIST ResourceList)
|
||||
{
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
WCHAR DeviceNameBuffer[32];
|
||||
UNICODE_STRING DeviceName;
|
||||
WCHAR LinkNameBuffer[32];
|
||||
UNICODE_STRING LinkName;
|
||||
WCHAR ComPortBuffer[32];
|
||||
UNICODE_STRING ComPort;
|
||||
ULONG Vector = 0;
|
||||
ULONG i, j;
|
||||
KIRQL Dirql;
|
||||
KAFFINITY Affinity = 0;
|
||||
KINTERRUPT_MODE InterruptMode = Latched;
|
||||
BOOLEAN ShareInterrupt = TRUE;
|
||||
OBJECT_ATTRIBUTES objectAttributes;
|
||||
PUCHAR ComPortBase;
|
||||
UNICODE_STRING KeyName;
|
||||
HANDLE hKey;
|
||||
NTSTATUS Status;
|
||||
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
ASSERT(DeviceExtension->PnpState == dsStopped);
|
||||
|
||||
DeviceExtension->ComPort = DeviceExtension->SerialPortNumber + 1;
|
||||
DeviceExtension->BaudRate = 19200 | SERIAL_BAUD_USER;
|
||||
DeviceExtension->BaseAddress = 0;
|
||||
Dirql = 0;
|
||||
for (i = 0; i < ResourceList->Count; i++)
|
||||
{
|
||||
for (j = 0; j < ResourceList->List[i].PartialResourceList.Count; j++)
|
||||
{
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor = &ResourceList->List[i].PartialResourceList.PartialDescriptors[j];
|
||||
switch (PartialDescriptor->Type)
|
||||
{
|
||||
case CmResourceTypePort:
|
||||
if (PartialDescriptor->u.Port.Length < 8)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
if (DeviceExtension->BaseAddress != 0)
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
DeviceExtension->BaseAddress = PartialDescriptor->u.Port.Start.u.LowPart;
|
||||
break;
|
||||
case CmResourceTypeInterrupt:
|
||||
if (Dirql != 0)
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
Dirql = (KIRQL)PartialDescriptor->u.Interrupt.Level;
|
||||
Vector = PartialDescriptor->u.Interrupt.Vector;
|
||||
Affinity = PartialDescriptor->u.Interrupt.Affinity;
|
||||
if (PartialDescriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
|
||||
InterruptMode = Latched;
|
||||
else
|
||||
InterruptMode = LevelSensitive;
|
||||
ShareInterrupt = (PartialDescriptor->ShareDisposition == CmResourceShareShared);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
DPRINT("Serial: New COM port. Base = 0x%lx, Irql = %u\n",
|
||||
DeviceExtension->BaseAddress, Dirql);
|
||||
if (!DeviceExtension->BaseAddress)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
/* FIXME: we should be able to continue and use polling method
|
||||
* for read/write if we don't have an interrupt */
|
||||
if (!Dirql)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
if (DeviceExtension->UartType == UartUnknown)
|
||||
DeviceExtension->UartType = SerialDetectUartType(ComPortBase);
|
||||
|
||||
/* Get current settings */
|
||||
DeviceExtension->IER = READ_PORT_UCHAR(SER_IER(ComPortBase));
|
||||
DeviceExtension->MCR = READ_PORT_UCHAR(SER_MCR(ComPortBase));
|
||||
DeviceExtension->MSR = READ_PORT_UCHAR(SER_MSR(ComPortBase));
|
||||
DeviceExtension->WaitMask = 0;
|
||||
|
||||
/* Set baud rate */
|
||||
Status = SerialSetBaudRate(DeviceExtension, DeviceExtension->BaudRate);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: SerialSetBaudRate() failed with status 0x%08x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Set line control */
|
||||
DeviceExtension->SerialLineControl.StopBits = STOP_BIT_1;
|
||||
DeviceExtension->SerialLineControl.Parity = NO_PARITY;
|
||||
DeviceExtension->SerialLineControl.WordLength = 8;
|
||||
Status = SerialSetLineControl(DeviceExtension, &DeviceExtension->SerialLineControl);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: SerialSetLineControl() failed with status 0x%08x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Clear receive/transmit buffers */
|
||||
if (DeviceExtension->UartType >= Uart16550)
|
||||
{
|
||||
WRITE_PORT_UCHAR(SER_FCR(ComPortBase),
|
||||
SR_FCR_CLEAR_RCVR | SR_FCR_CLEAR_XMIT);
|
||||
}
|
||||
|
||||
/* Create link \DosDevices\COMX -> \Device\SerialX */
|
||||
swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceExtension->SerialPortNumber);
|
||||
swprintf(LinkNameBuffer, L"\\DosDevices\\COM%lu", DeviceExtension->ComPort);
|
||||
swprintf(ComPortBuffer, L"COM%lu", DeviceExtension->ComPort);
|
||||
RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
|
||||
RtlInitUnicodeString(&LinkName, LinkNameBuffer);
|
||||
RtlInitUnicodeString(&ComPort, ComPortBuffer);
|
||||
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 */
|
||||
Status = IoConnectInterrupt(
|
||||
&DeviceExtension->Interrupt, SerialInterruptService,
|
||||
DeviceObject, NULL,
|
||||
Vector, Dirql, Dirql,
|
||||
InterruptMode, ShareInterrupt,
|
||||
Affinity, FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: IoConnectInterrupt() failed with status 0x%08x\n", Status);
|
||||
IoDeleteSymbolicLink(&LinkName);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Write an entry value under HKLM\HARDWARE\DeviceMap\SERIALCOMM */
|
||||
/* This step is not mandatory, so don't exit in case of error */
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\HARDWARE\\DeviceMap\\SERIALCOMM");
|
||||
InitializeObjectAttributes(&objectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, NULL, NULL);
|
||||
Status = ZwCreateKey(&hKey, KEY_SET_VALUE, &objectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Key = \Device\Serialx, Value = COMx */
|
||||
ZwSetValueKey(hKey, &DeviceName, 0, REG_SZ, &ComPortBuffer, ComPort.Length + sizeof(WCHAR));
|
||||
ZwClose(hKey);
|
||||
}
|
||||
|
||||
DeviceExtension->PnpState = dsStarted;
|
||||
|
||||
DeviceExtension->IER |= 0x1f; /* Activate interrupt mode */
|
||||
DeviceExtension->IER &= ~1; /* FIXME: Disable receive byte interrupt */
|
||||
WRITE_PORT_UCHAR(SER_IER(ComPortBase), DeviceExtension->IER);
|
||||
|
||||
DeviceExtension->MCR |= 0x03; /* Activate DTR, RTS */
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialPnp(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
ULONG MinorFunction;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
ULONG Information = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
MinorFunction = Stack->MinorFunction;
|
||||
|
||||
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,
|
||||
Stack->Parameters.StartDevice.AllocatedResources);
|
||||
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);
|
||||
return ForwardIrpAndForget(DeviceObject, Irp);
|
||||
}
|
||||
}
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
24
reactos/drivers/dd/serial/power.c
Normal file
24
reactos/drivers/dd/serial/power.c
Normal file
@@ -0,0 +1,24 @@
|
||||
/* $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");
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
269
reactos/drivers/dd/serial/rw.c
Normal file
269
reactos/drivers/dd/serial/rw.c
Normal file
@@ -0,0 +1,269 @@
|
||||
/* $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);
|
||||
|
||||
return Irp->AssociatedIrp.SystemBuffer;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialRead(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
ULONG Length;
|
||||
ULONG Information = 0;
|
||||
PUCHAR Buffer;
|
||||
PUCHAR ComPortBase;
|
||||
UCHAR ReceivedByte;
|
||||
KIRQL Irql;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
DPRINT("Serial: IRP_MJ_READ\n");
|
||||
|
||||
/* FIXME: pend operation if possible */
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
Length = Stack->Parameters.Read.Length;
|
||||
Buffer = SerialGetUserBuffer(Irp);
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
if (Stack->Parameters.Read.ByteOffset.QuadPart != 0 || Buffer == NULL)
|
||||
{
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
if (Length == 0)
|
||||
{
|
||||
Status = STATUS_SUCCESS;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (!NT_SUCCESS(Status))
|
||||
goto ByeBye;
|
||||
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
||||
while (Length-- > 0)
|
||||
{
|
||||
Status = PopCircularBufferEntry(&DeviceExtension->InputBuffer, &ReceivedByte);
|
||||
if (!NT_SUCCESS(Status))
|
||||
break;
|
||||
DPRINT("Serial: read from buffer 0x%x (%c)\n", ReceivedByte, ReceivedByte);
|
||||
Buffer[Information++] = ReceivedByte;
|
||||
}
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
if (Length > 0 &&
|
||||
!(DeviceExtension->SerialTimeOuts.ReadIntervalTimeout == INFINITE &&
|
||||
DeviceExtension->SerialTimeOuts.ReadTotalTimeoutConstant == 0 &&
|
||||
DeviceExtension->SerialTimeOuts.ReadTotalTimeoutMultiplier == 0))
|
||||
{
|
||||
ULONG IntervalTimeout = 0;
|
||||
ULONG TotalTimeout = 0;
|
||||
BOOLEAN UseIntervalTimeout = FALSE;
|
||||
BOOLEAN UseTotalTimeout = FALSE;
|
||||
ULONG ThisByteTimeout;
|
||||
BOOLEAN IsByteReceived;
|
||||
ULONG i;
|
||||
/* Extract timeouts informations */
|
||||
if (DeviceExtension->SerialTimeOuts.ReadIntervalTimeout == INFINITE &&
|
||||
DeviceExtension->SerialTimeOuts.ReadTotalTimeoutMultiplier == INFINITE &&
|
||||
DeviceExtension->SerialTimeOuts.ReadTotalTimeoutConstant > 0 &&
|
||||
DeviceExtension->SerialTimeOuts.ReadTotalTimeoutConstant < INFINITE)
|
||||
{
|
||||
if (Information > 0)
|
||||
{
|
||||
/* don't read mode bytes */
|
||||
Length = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read only one byte */
|
||||
UseTotalTimeout = TRUE;
|
||||
TotalTimeout = DeviceExtension->SerialTimeOuts.ReadTotalTimeoutConstant;
|
||||
Length = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DeviceExtension->SerialTimeOuts.ReadIntervalTimeout != 0)
|
||||
{
|
||||
UseIntervalTimeout = TRUE;
|
||||
IntervalTimeout = DeviceExtension->SerialTimeOuts.ReadIntervalTimeout;
|
||||
}
|
||||
if (DeviceExtension->SerialTimeOuts.ReadTotalTimeoutConstant != 0 ||
|
||||
DeviceExtension->SerialTimeOuts.ReadTotalTimeoutMultiplier != 0)
|
||||
{
|
||||
UseTotalTimeout = TRUE;
|
||||
TotalTimeout = DeviceExtension->SerialTimeOuts.ReadTotalTimeoutConstant +
|
||||
DeviceExtension->SerialTimeOuts.ReadTotalTimeoutMultiplier * Length;
|
||||
}
|
||||
}
|
||||
DPRINT("Serial: UseIntervalTimeout = %ws, IntervalTimeout = %lu\n",
|
||||
UseIntervalTimeout ? L"YES" : L"NO",
|
||||
UseIntervalTimeout ? IntervalTimeout : 0);
|
||||
DPRINT("Serial: UseTotalTimeout = %ws, TotalTimeout = %lu\n",
|
||||
UseTotalTimeout ? L"YES" : L"NO",
|
||||
UseTotalTimeout ? TotalTimeout : 0);
|
||||
|
||||
/* FIXME: it should be better to use input buffer instead of
|
||||
* disabling interrupts, and try to directly read for port! */
|
||||
|
||||
/* FIXME: NtQueryPerformanceCounter gives a more accurate
|
||||
* timer, but it is not available on all computers. First try
|
||||
* NtQueryPerformanceCounter, and current method if it is not
|
||||
* implemented. */
|
||||
|
||||
/* FIXME: remove disabling interrupts */
|
||||
WRITE_PORT_UCHAR(SER_IER(ComPortBase), DeviceExtension->IER & ~1);
|
||||
while (Length > 0)
|
||||
{
|
||||
ThisByteTimeout = IntervalTimeout;
|
||||
IsByteReceived = FALSE;
|
||||
while (TRUE)
|
||||
{
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
#if 1
|
||||
if ((READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_DR) != 0)
|
||||
{
|
||||
ReceivedByte = READ_PORT_UCHAR(ComPortBase);
|
||||
DPRINT("Serial: received byte 0x%02x (%c)\n", ReceivedByte, ReceivedByte);
|
||||
IsByteReceived = TRUE;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
||||
if (!IsCircularBufferEmpty(&DeviceExtension->InputBuffer))
|
||||
{
|
||||
PopCircularBufferEntry(&DeviceExtension->InputBuffer, &ReceivedByte);
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
DPRINT("Serial: reading byte from buffer 0x%02x (%c)\n", ReceivedByte, ReceivedByte);
|
||||
IsByteReceived = TRUE;
|
||||
break;
|
||||
}
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
#endif
|
||||
KeStallExecutionProcessor(1);
|
||||
}
|
||||
if (IsByteReceived) break;
|
||||
if (UseIntervalTimeout)
|
||||
{
|
||||
if (ThisByteTimeout == 0) break; else ThisByteTimeout--;
|
||||
}
|
||||
if (UseTotalTimeout)
|
||||
{
|
||||
if (TotalTimeout == 0) break; else TotalTimeout--;
|
||||
}
|
||||
}
|
||||
if (!IsByteReceived) break;
|
||||
Buffer[Information++] = ReceivedByte;
|
||||
Length--;
|
||||
}
|
||||
/* FIXME: remove enabling interrupts */
|
||||
WRITE_PORT_UCHAR(SER_IER(ComPortBase), DeviceExtension->IER);
|
||||
}
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
|
||||
ByeBye:
|
||||
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;
|
||||
KIRQL Irql;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
DPRINT("Serial: IRP_MJ_WRITE\n");
|
||||
|
||||
/* FIXME: pend operation if possible */
|
||||
/* FIXME: use write timeouts */
|
||||
|
||||
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;
|
||||
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
|
||||
if (IsCircularBufferEmpty(&DeviceExtension->OutputBuffer))
|
||||
{
|
||||
/* Put the maximum amount of data in UART output buffer */
|
||||
while (Information < Length)
|
||||
{
|
||||
/* if UART output buffer is not full, directly write to it */
|
||||
if ((READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_TBE) != 0)
|
||||
{
|
||||
DPRINT("Serial: direct write 0x%02x (%c)\n", Buffer[Information], Buffer[Information]);
|
||||
WRITE_PORT_UCHAR(SER_THR(ComPortBase), Buffer[Information]);
|
||||
DeviceExtension->SerialPerfStats.TransmittedCount++;
|
||||
Information++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* write remaining bytes into output buffer */
|
||||
while (Information < Length)
|
||||
{
|
||||
Status = PushCircularBufferEntry(&DeviceExtension->OutputBuffer, Buffer[Information]);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: buffer overrun on COM%lu\n", DeviceExtension->ComPort);
|
||||
DeviceExtension->SerialPerfStats.BufferOverrunErrorCount++;
|
||||
break;
|
||||
}
|
||||
DPRINT1("Serial: write to buffer 0x%02x\n", Buffer[Information]);
|
||||
Information++;
|
||||
}
|
||||
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
|
||||
ByeBye:
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
@@ -1,160 +1,47 @@
|
||||
/* $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);
|
||||
};
|
||||
ULONG i;
|
||||
|
||||
DriverObject->DriverUnload = DriverUnload;
|
||||
DriverObject->DriverExtension->AddDevice = SerialAddDevice;
|
||||
|
||||
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
|
||||
DriverObject->MajorFunction[i] = ForwardIrpAndForget;
|
||||
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 DetectLegacyDevices(DriverObject);
|
||||
}
|
||||
|
318
reactos/drivers/dd/serial/serial.h
Normal file
318
reactos/drivers/dd/serial/serial.h
Normal file
@@ -0,0 +1,318 @@
|
||||
#if defined(__GNUC__)
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/ntddser.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
/* FIXME: these prototypes 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 enum
|
||||
{
|
||||
UartUnknown,
|
||||
Uart8250,
|
||||
Uart16450,
|
||||
Uart16550,
|
||||
Uart16550A
|
||||
} UART_TYPE;
|
||||
|
||||
typedef struct _CIRCULAR_BUFFER
|
||||
{
|
||||
PUCHAR Buffer;
|
||||
ULONG Length;
|
||||
ULONG ReadPosition;
|
||||
ULONG WritePosition;
|
||||
} CIRCULAR_BUFFER, *PCIRCULAR_BUFFER;
|
||||
|
||||
typedef struct _SERIAL_DEVICE_EXTENSION
|
||||
{
|
||||
PDEVICE_OBJECT Pdo;
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
SERIAL_DEVICE_STATE PnpState;
|
||||
IO_REMOVE_LOCK RemoveLock;
|
||||
|
||||
ULONG SerialPortNumber;
|
||||
|
||||
ULONG ComPort;
|
||||
ULONG BaudRate;
|
||||
ULONG BaseAddress;
|
||||
PKINTERRUPT Interrupt;
|
||||
KDPC ReceivedByteDpc;
|
||||
KDPC SendByteDpc;
|
||||
|
||||
SERIAL_LINE_CONTROL SerialLineControl;
|
||||
UART_TYPE UartType;
|
||||
ULONG WaitMask;
|
||||
|
||||
SERIALPERF_STATS SerialPerfStats;
|
||||
SERIAL_TIMEOUTS SerialTimeOuts;
|
||||
BOOLEAN IsOpened;
|
||||
CIRCULAR_BUFFER InputBuffer;
|
||||
KSPIN_LOCK InputBufferLock;
|
||||
CIRCULAR_BUFFER OutputBuffer;
|
||||
KSPIN_LOCK OutputBufferLock;
|
||||
|
||||
/* 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')
|
||||
|
||||
#define INFINITE ((ULONG)-1)
|
||||
|
||||
/* 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_IIR(x) ((x)+2)
|
||||
#define SR_IIR_SELF 0x00
|
||||
#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_FCR(x) ((x)+2)
|
||||
#define SR_FCR_ENABLE_FIFO 0x01
|
||||
#define SR_FCR_CLEAR_RCVR (0x02 | SR_FCR_ENABLE_FIFO)
|
||||
#define SR_FCR_CLEAR_XMIT (0x04 | SR_FCR_ENABLE_FIFO)
|
||||
#define SR_FCR_1_BYTE (0x00 | SR_FCR_ENABLE_FIFO)
|
||||
#define SR_FCR_4_BYTES (0x40 | SR_FCR_ENABLE_FIFO)
|
||||
#define SR_FCR_8_BYTES (0x80 | SR_FCR_ENABLE_FIFO)
|
||||
#define SR_FCR_14_BYTES (0xC0 | SR_FCR_ENABLE_FIFO)
|
||||
#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)
|
||||
|
||||
/************************************ circularbuffer.c */
|
||||
|
||||
/* FIXME: transform these functions into #define? */
|
||||
NTSTATUS
|
||||
InitializeCircularBuffer(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN ULONG BufferSize);
|
||||
|
||||
NTSTATUS
|
||||
FreeCircularBuffer(
|
||||
IN PCIRCULAR_BUFFER pBuffer);
|
||||
|
||||
BOOLEAN
|
||||
IsCircularBufferEmpty(
|
||||
IN PCIRCULAR_BUFFER pBuffer);
|
||||
|
||||
NTSTATUS
|
||||
PushCircularBufferEntry(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN UCHAR Entry);
|
||||
|
||||
NTSTATUS
|
||||
PopCircularBufferEntry(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
OUT PUCHAR Entry);
|
||||
|
||||
NTSTATUS
|
||||
IncreaseCircularBufferSize(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN ULONG NewBufferSize);
|
||||
|
||||
/************************************ 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);
|
||||
|
||||
/************************************ legacy.c */
|
||||
|
||||
UART_TYPE
|
||||
SerialDetectUartType(
|
||||
IN PUCHAR ComPortBase);
|
||||
|
||||
NTSTATUS
|
||||
DetectLegacyDevices(
|
||||
IN PDRIVER_OBJECT DriverObject);
|
||||
|
||||
/************************************ misc.c */
|
||||
|
||||
NTSTATUS
|
||||
ForwardIrpAndWait(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ForwardIrpAndForget(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
VOID STDCALL
|
||||
SerialReceiveByte(
|
||||
IN PKDPC Dpc,
|
||||
IN PVOID pDeviceExtension, // real type PSERIAL_DEVICE_EXTENSION
|
||||
IN PVOID pByte, // real type UCHAR
|
||||
IN PVOID Unused);
|
||||
|
||||
VOID STDCALL
|
||||
SerialSendByte(
|
||||
IN PKDPC Dpc,
|
||||
IN PVOID pDeviceExtension, // real type PSERIAL_DEVICE_EXTENSION
|
||||
IN PVOID Unused1,
|
||||
IN PVOID Unused2);
|
||||
|
||||
BOOLEAN STDCALL
|
||||
SerialInterruptService(
|
||||
IN PKINTERRUPT Interrupt,
|
||||
IN OUT PVOID ServiceContext);
|
||||
|
||||
/************************************ pnp.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialAddDeviceInternal(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT Pdo,
|
||||
IN UART_TYPE UartType,
|
||||
OUT PDEVICE_OBJECT* pFdo OPTIONAL);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialAddDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT Pdo);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialPnpStartDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PCM_RESOURCE_LIST ResourceList);
|
||||
|
||||
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);
|
||||
|
@@ -49,6 +49,7 @@ NpfsFindListeningServerInstance(PNPFS_PIPE Pipe)
|
||||
{
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PNPFS_WAITER_ENTRY Waiter;
|
||||
KIRQL oldIrql;
|
||||
|
||||
CurrentEntry = Pipe->WaiterListHead.Flink;
|
||||
while (CurrentEntry != &Pipe->WaiterListHead)
|
||||
@@ -58,11 +59,15 @@ NpfsFindListeningServerInstance(PNPFS_PIPE Pipe)
|
||||
!Waiter->Irp->Cancel)
|
||||
{
|
||||
DPRINT("Server found! Fcb %p\n", Waiter->Fcb);
|
||||
|
||||
if (IoSetCancelRoutine(Waiter->Irp, NULL) != NULL)
|
||||
{
|
||||
|
||||
IoAcquireCancelSpinLock(&oldIrql);
|
||||
if (!Waiter->Irp->Cancel)
|
||||
{
|
||||
IoSetCancelRoutine(Waiter->Irp, NULL);
|
||||
IoReleaseCancelSpinLock(oldIrql);
|
||||
return Waiter->Fcb;
|
||||
}
|
||||
IoReleaseCancelSpinLock(oldIrql);
|
||||
}
|
||||
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
@@ -87,9 +92,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 = STATUS_PIPE_CONNECTED;
|
||||
Waiter->Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Waiter->Irp, IO_NO_INCREMENT);
|
||||
|
||||
RemoveEntryList(&Waiter->Entry);
|
||||
@@ -175,7 +179,7 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
||||
/* Initialize data list. */
|
||||
if (Pipe->OutboundQuota)
|
||||
{
|
||||
ClientFcb->Data = ExAllocatePool(NonPagedPool, Pipe->OutboundQuota);
|
||||
ClientFcb->Data = ExAllocatePool(PagedPool, Pipe->OutboundQuota);
|
||||
if (ClientFcb->Data == NULL)
|
||||
{
|
||||
DPRINT("No memory!\n");
|
||||
@@ -196,7 +200,7 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
||||
ClientFcb->ReadDataAvailable = 0;
|
||||
ClientFcb->WriteQuotaAvailable = Pipe->OutboundQuota;
|
||||
ClientFcb->MaxDataLength = Pipe->OutboundQuota;
|
||||
KeInitializeSpinLock(&ClientFcb->DataListLock);
|
||||
ExInitializeFastMutex(&ClientFcb->DataListLock);
|
||||
KeInitializeEvent(&ClientFcb->ConnectEvent, SynchronizationEvent, FALSE);
|
||||
KeInitializeEvent(&ClientFcb->Event, SynchronizationEvent, FALSE);
|
||||
|
||||
@@ -456,13 +460,16 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
||||
|
||||
if (Pipe->InboundQuota)
|
||||
{
|
||||
Fcb->Data = ExAllocatePool(NonPagedPool, Pipe->InboundQuota);
|
||||
Fcb->Data = ExAllocatePool(PagedPool, Pipe->InboundQuota);
|
||||
if (Fcb->Data == NULL)
|
||||
{
|
||||
ExFreePool(Fcb);
|
||||
|
||||
if (NewPipe)
|
||||
{
|
||||
KeLockMutex(&DeviceExt->PipeListLock);
|
||||
RemoveEntryList(&Pipe->PipeListEntry);
|
||||
KeUnlockMutex(&DeviceExt->PipeListLock);
|
||||
RtlFreeUnicodeString(&Pipe->PipeName);
|
||||
ExFreePool(Pipe);
|
||||
}
|
||||
@@ -482,14 +489,10 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
||||
Fcb->ReadDataAvailable = 0;
|
||||
Fcb->WriteQuotaAvailable = Pipe->InboundQuota;
|
||||
Fcb->MaxDataLength = Pipe->InboundQuota;
|
||||
KeInitializeSpinLock(&Fcb->DataListLock);
|
||||
ExInitializeFastMutex(&Fcb->DataListLock);
|
||||
|
||||
Pipe->CurrentInstances++;
|
||||
|
||||
KeLockMutex(&Pipe->FcbListLock);
|
||||
InsertTailList(&Pipe->ServerFcbListHead, &Fcb->FcbListEntry);
|
||||
KeUnlockMutex(&Pipe->FcbListLock);
|
||||
|
||||
Fcb->Pipe = Pipe;
|
||||
Fcb->PipeEnd = FILE_PIPE_SERVER_END;
|
||||
Fcb->PipeState = FILE_PIPE_LISTENING_STATE;
|
||||
@@ -503,6 +506,10 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
||||
SynchronizationEvent,
|
||||
FALSE);
|
||||
|
||||
KeLockMutex(&Pipe->FcbListLock);
|
||||
InsertTailList(&Pipe->ServerFcbListHead, &Fcb->FcbListEntry);
|
||||
KeUnlockMutex(&Pipe->FcbListLock);
|
||||
|
||||
FileObject->FsContext = Fcb;
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
@@ -514,6 +521,125 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NpfsCleanup(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
PNPFS_DEVICE_EXTENSION DeviceExt;
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
PFILE_OBJECT FileObject;
|
||||
PNPFS_FCB Fcb;
|
||||
PNPFS_PIPE Pipe;
|
||||
BOOL Server;
|
||||
|
||||
DPRINT("NpfsCleanup(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
|
||||
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
FileObject = IoStack->FileObject;
|
||||
Fcb = FileObject->FsContext;
|
||||
|
||||
if (Fcb == NULL)
|
||||
{
|
||||
DPRINT("Success!\n");
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
DPRINT("Fcb %x\n", Fcb);
|
||||
Pipe = Fcb->Pipe;
|
||||
|
||||
DPRINT("Cleaning pipe %wZ\n", &Pipe->PipeName);
|
||||
|
||||
KeLockMutex(&Pipe->FcbListLock);
|
||||
|
||||
Server = (Fcb->PipeEnd == FILE_PIPE_SERVER_END);
|
||||
|
||||
if (Server)
|
||||
{
|
||||
/* FIXME: Clean up existing connections here ?? */
|
||||
DPRINT("Server\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("Client\n");
|
||||
}
|
||||
|
||||
if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
|
||||
{
|
||||
if (Fcb->OtherSide)
|
||||
{
|
||||
Fcb->OtherSide->PipeState = FILE_PIPE_DISCONNECTED_STATE;
|
||||
Fcb->OtherSide->OtherSide = NULL;
|
||||
/*
|
||||
* Signaling the write event. If is possible that an other
|
||||
* thread waits for an empty buffer.
|
||||
*/
|
||||
KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
}
|
||||
else if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
|
||||
{
|
||||
PLIST_ENTRY Entry;
|
||||
PNPFS_WAITER_ENTRY WaitEntry = NULL;
|
||||
BOOLEAN Complete = FALSE;
|
||||
KIRQL oldIrql;
|
||||
|
||||
Entry = Fcb->Pipe->WaiterListHead.Flink;
|
||||
while (Entry != &Fcb->Pipe->WaiterListHead)
|
||||
{
|
||||
WaitEntry = CONTAINING_RECORD(Entry, NPFS_WAITER_ENTRY, Entry);
|
||||
if (WaitEntry->Fcb == Fcb)
|
||||
{
|
||||
RemoveEntryList(Entry);
|
||||
IoAcquireCancelSpinLock(&oldIrql);
|
||||
if (!Irp->Cancel)
|
||||
{
|
||||
IoSetCancelRoutine(WaitEntry->Irp, NULL);
|
||||
Complete = TRUE;
|
||||
}
|
||||
IoReleaseCancelSpinLock(oldIrql);
|
||||
break;
|
||||
}
|
||||
Entry = Entry->Flink;
|
||||
}
|
||||
|
||||
if (Entry != &Fcb->Pipe->WaiterListHead)
|
||||
{
|
||||
if (Complete)
|
||||
{
|
||||
WaitEntry->Irp->IoStatus.Status = STATUS_PIPE_BROKEN;
|
||||
WaitEntry->Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(WaitEntry->Irp, IO_NO_INCREMENT);
|
||||
}
|
||||
ExFreePool(WaitEntry);
|
||||
}
|
||||
}
|
||||
Fcb->PipeState = FILE_PIPE_CLOSING_STATE;
|
||||
|
||||
KeUnlockMutex(&Pipe->FcbListLock);
|
||||
|
||||
ExAcquireFastMutex(&Fcb->DataListLock);
|
||||
if (Fcb->Data)
|
||||
{
|
||||
ExFreePool(Fcb->Data);
|
||||
Fcb->Data = NULL;
|
||||
Fcb->ReadPtr = NULL;
|
||||
Fcb->WritePtr = NULL;
|
||||
}
|
||||
ExReleaseFastMutex(&Fcb->DataListLock);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
DPRINT("Success!\n");
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NpfsClose(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
@@ -552,7 +678,6 @@ NpfsClose(PDEVICE_OBJECT DeviceObject,
|
||||
|
||||
if (Server)
|
||||
{
|
||||
/* FIXME: Clean up existing connections here ?? */
|
||||
DPRINT("Server\n");
|
||||
Pipe->CurrentInstances--;
|
||||
}
|
||||
@@ -561,27 +686,12 @@ NpfsClose(PDEVICE_OBJECT DeviceObject,
|
||||
DPRINT("Client\n");
|
||||
}
|
||||
|
||||
if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
|
||||
{
|
||||
if (Fcb->OtherSide)
|
||||
{
|
||||
Fcb->OtherSide->PipeState = FILE_PIPE_CLOSING_STATE;
|
||||
Fcb->OtherSide->OtherSide = NULL;
|
||||
/*
|
||||
* Signaling the write event. If is possible that an other
|
||||
* thread waits for an empty buffer.
|
||||
*/
|
||||
KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
|
||||
Fcb->PipeState = 0;
|
||||
}
|
||||
ASSERT (Fcb->PipeState == FILE_PIPE_CLOSING_STATE);
|
||||
|
||||
FileObject->FsContext = NULL;
|
||||
|
||||
RemoveEntryList(&Fcb->FcbListEntry);
|
||||
if (Fcb->Data)
|
||||
ExFreePool(Fcb->Data);
|
||||
|
||||
ExFreePool(Fcb);
|
||||
|
||||
KeUnlockMutex(&Pipe->FcbListLock);
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
static VOID
|
||||
static VOID STDCALL
|
||||
NpfsListeningCancelRoutine(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
@@ -46,6 +46,7 @@ NpfsAddListeningServerInstance(PIRP Irp,
|
||||
PNPFS_FCB Fcb)
|
||||
{
|
||||
PNPFS_WAITER_ENTRY Entry;
|
||||
KIRQL oldIrql;
|
||||
|
||||
Entry = ExAllocatePool(NonPagedPool, sizeof(NPFS_WAITER_ENTRY));
|
||||
if (Entry == NULL)
|
||||
@@ -61,13 +62,15 @@ NpfsAddListeningServerInstance(PIRP Irp,
|
||||
Irp->Tail.Overlay.DriverContext[0] = Entry;
|
||||
InsertTailList(&Fcb->Pipe->WaiterListHead, &Entry->Entry);
|
||||
|
||||
IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine);
|
||||
|
||||
IoAcquireCancelSpinLock(&oldIrql);
|
||||
if (!Irp->Cancel)
|
||||
{
|
||||
IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine);
|
||||
IoReleaseCancelSpinLock(oldIrql);
|
||||
KeUnlockMutex(&Fcb->Pipe->FcbListLock);
|
||||
return STATUS_PENDING;
|
||||
}
|
||||
IoReleaseCancelSpinLock(oldIrql);
|
||||
|
||||
RemoveEntryList(&Entry->Entry);
|
||||
|
||||
|
@@ -40,7 +40,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
NpfsSetInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] =
|
||||
NpfsQueryVolumeInformation;
|
||||
// DriverObject->MajorFunction[IRP_MJ_CLEANUP] = NpfsCleanup;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = NpfsCleanup;
|
||||
DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = NpfsFlushBuffers;
|
||||
// DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
|
||||
// NpfsDirectoryControl;
|
||||
@@ -73,8 +73,10 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
/* initialize the device extension */
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
InitializeListHead(&DeviceExtension->PipeListHead);
|
||||
InitializeListHead(&DeviceExtension->ThreadListHead);
|
||||
KeInitializeMutex(&DeviceExtension->PipeListLock,
|
||||
0);
|
||||
DeviceExtension->EmptyWaiterCount = 0;
|
||||
|
||||
/* set the size quotas */
|
||||
DeviceExtension->MinQuota = PAGE_SIZE;
|
||||
|
@@ -6,7 +6,9 @@
|
||||
typedef struct _NPFS_DEVICE_EXTENSION
|
||||
{
|
||||
LIST_ENTRY PipeListHead;
|
||||
LIST_ENTRY ThreadListHead;
|
||||
KMUTEX PipeListLock;
|
||||
ULONG EmptyWaiterCount;
|
||||
ULONG MinQuota;
|
||||
ULONG DefaultQuota;
|
||||
ULONG MaxQuota;
|
||||
@@ -20,6 +22,7 @@ typedef struct _NPFS_PIPE
|
||||
LIST_ENTRY ServerFcbListHead;
|
||||
LIST_ENTRY ClientFcbListHead;
|
||||
LIST_ENTRY WaiterListHead;
|
||||
LIST_ENTRY EmptyBufferListHead;
|
||||
ULONG PipeType;
|
||||
ULONG ReadMode;
|
||||
ULONG WriteMode;
|
||||
@@ -50,9 +53,29 @@ typedef struct _NPFS_FCB
|
||||
PVOID WritePtr;
|
||||
ULONG MaxDataLength;
|
||||
|
||||
KSPIN_LOCK DataListLock; /* Data queue lock */
|
||||
FAST_MUTEX DataListLock; /* Data queue lock */
|
||||
} NPFS_FCB, *PNPFS_FCB;
|
||||
|
||||
typedef struct _NPFS_CONTEXT
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PIRP Irp;
|
||||
PNPFS_FCB Fcb;
|
||||
UCHAR MajorFunction;
|
||||
BOOLEAN AllocatedFromPool;
|
||||
} NPFS_CONTEXT, *PNPFS_CONTEXT;
|
||||
|
||||
typedef struct _NPFS_THREAD_CONTEXT
|
||||
{
|
||||
ULONG Count;
|
||||
KEVENT Event;
|
||||
PNPFS_DEVICE_EXTENSION DeviceExt;
|
||||
LIST_ENTRY ListEntry;
|
||||
PVOID WaitObjectArray[MAXIMUM_WAIT_OBJECTS];
|
||||
KWAIT_BLOCK WaitBlockArray[MAXIMUM_WAIT_OBJECTS];
|
||||
PNPFS_CONTEXT WaitContextArray[MAXIMUM_WAIT_OBJECTS];
|
||||
} NPFS_THREAD_CONTEXT, *PNPFS_THREAD_CONTEXT;
|
||||
|
||||
typedef struct _NPFS_WAITER_ENTRY
|
||||
{
|
||||
LIST_ENTRY Entry;
|
||||
@@ -76,6 +99,7 @@ extern NPAGED_LOOKASIDE_LIST NpfsPipeDataLookasideList;
|
||||
|
||||
NTSTATUS STDCALL NpfsCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
NTSTATUS STDCALL NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
NTSTATUS STDCALL NpfsCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
NTSTATUS STDCALL NpfsClose(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
|
||||
NTSTATUS STDCALL NpfsRead(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
|
@@ -46,16 +46,197 @@ VOID HexDump(PUCHAR Buffer, ULONG Length)
|
||||
}
|
||||
#endif
|
||||
|
||||
static NTSTATUS
|
||||
NpfsReadFromPipe(PNPFS_CONTEXT Context);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
static VOID STDCALL
|
||||
NpfsWaitingCancelRoutine(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PNPFS_CONTEXT Context;
|
||||
PNPFS_DEVICE_EXTENSION DeviceExt;
|
||||
|
||||
DPRINT1("NpfsWaitingCancelRoutine() called\n");
|
||||
|
||||
IoReleaseCancelSpinLock(Irp->CancelIrql);
|
||||
|
||||
Context = Irp->Tail.Overlay.DriverContext[0];
|
||||
DeviceExt = Context->DeviceObject->DeviceExtension;
|
||||
|
||||
KeLockMutex(&DeviceExt->PipeListLock);
|
||||
KeSetEvent(&Context->Fcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
KeUnlockMutex(&DeviceExt->PipeListLock);
|
||||
}
|
||||
|
||||
static VOID STDCALL
|
||||
NpfsWaiterThread(PVOID Context)
|
||||
{
|
||||
PNPFS_THREAD_CONTEXT ThreadContext = (PNPFS_THREAD_CONTEXT) Context;
|
||||
ULONG CurrentCount, Count = 0;
|
||||
PNPFS_CONTEXT WaitContext = NULL;
|
||||
NTSTATUS Status;
|
||||
BOOLEAN Terminate = FALSE;
|
||||
BOOLEAN Cancel = FALSE;
|
||||
KIRQL oldIrql;
|
||||
|
||||
KeLockMutex(&ThreadContext->DeviceExt->PipeListLock);
|
||||
|
||||
while (1)
|
||||
{
|
||||
CurrentCount = ThreadContext->Count;
|
||||
KeResetEvent(&ThreadContext->Event);
|
||||
KeUnlockMutex(&ThreadContext->DeviceExt->PipeListLock);
|
||||
if (WaitContext)
|
||||
{
|
||||
if (Cancel)
|
||||
{
|
||||
WaitContext->Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
WaitContext->Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(WaitContext->Irp, IO_NO_INCREMENT);
|
||||
ExFreePool(WaitContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (WaitContext->MajorFunction)
|
||||
{
|
||||
case IRP_MJ_READ:
|
||||
NpfsReadFromPipe(WaitContext);
|
||||
break;
|
||||
default:
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Terminate)
|
||||
{
|
||||
break;
|
||||
}
|
||||
Status = KeWaitForMultipleObjects(CurrentCount,
|
||||
ThreadContext->WaitObjectArray,
|
||||
WaitAny,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL,
|
||||
ThreadContext->WaitBlockArray);
|
||||
KeLockMutex(&ThreadContext->DeviceExt->PipeListLock);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
Count = Status - STATUS_SUCCESS;
|
||||
ASSERT (Count <= CurrentCount);
|
||||
if (Count > 0)
|
||||
{
|
||||
WaitContext = ThreadContext->WaitContextArray[Count];
|
||||
ThreadContext->Count--;
|
||||
ThreadContext->DeviceExt->EmptyWaiterCount++;
|
||||
ThreadContext->WaitObjectArray[Count] = ThreadContext->WaitObjectArray[ThreadContext->Count];
|
||||
ThreadContext->WaitContextArray[Count] = ThreadContext->WaitContextArray[ThreadContext->Count];
|
||||
IoAcquireCancelSpinLock(&oldIrql);
|
||||
Cancel = NULL == IoSetCancelRoutine(WaitContext->Irp, NULL);
|
||||
IoReleaseCancelSpinLock(oldIrql);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* someone has add a new wait request */
|
||||
WaitContext = NULL;
|
||||
}
|
||||
if (ThreadContext->Count == 1 && ThreadContext->DeviceExt->EmptyWaiterCount >= MAXIMUM_WAIT_OBJECTS)
|
||||
{
|
||||
/* it exist an other thread with empty wait slots, we can remove our thread from the list */
|
||||
RemoveEntryList(&ThreadContext->ListEntry);
|
||||
ThreadContext->DeviceExt->EmptyWaiterCount -= MAXIMUM_WAIT_OBJECTS - 1;
|
||||
Terminate = TRUE;
|
||||
}
|
||||
}
|
||||
KeUnlockMutex(&ThreadContext->DeviceExt->PipeListLock);
|
||||
ExFreePool(ThreadContext);
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
NpfsAddWaitingReader(PNPFS_DEVICE_EXTENSION DeviceExt, PNPFS_CONTEXT Context, PNPFS_FCB Fcb)
|
||||
{
|
||||
PLIST_ENTRY ListEntry;
|
||||
PNPFS_THREAD_CONTEXT ThreadContext;
|
||||
NTSTATUS Status;
|
||||
HANDLE hThread;
|
||||
KIRQL oldIrql;
|
||||
|
||||
KeLockMutex(&DeviceExt->PipeListLock);
|
||||
|
||||
ListEntry = DeviceExt->ThreadListHead.Flink;
|
||||
while (ListEntry != &DeviceExt->ThreadListHead)
|
||||
{
|
||||
ThreadContext = CONTAINING_RECORD(ListEntry, NPFS_THREAD_CONTEXT, ListEntry);
|
||||
if (ThreadContext->Count < MAXIMUM_WAIT_OBJECTS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
ListEntry = ListEntry->Flink;
|
||||
}
|
||||
if (ListEntry == &DeviceExt->ThreadListHead)
|
||||
{
|
||||
ThreadContext = ExAllocatePool(NonPagedPool, sizeof(NPFS_THREAD_CONTEXT));
|
||||
if (ThreadContext == NULL)
|
||||
{
|
||||
KeUnlockMutex(&DeviceExt->PipeListLock);
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
ThreadContext->DeviceExt = DeviceExt;
|
||||
KeInitializeEvent(&ThreadContext->Event, NotificationEvent, FALSE);
|
||||
ThreadContext->Count = 1;
|
||||
ThreadContext->WaitObjectArray[0] = &ThreadContext->Event;
|
||||
|
||||
|
||||
DPRINT("Creating a new system thread for waiting read requests\n");
|
||||
|
||||
Status = PsCreateSystemThread(&hThread,
|
||||
THREAD_ALL_ACCESS,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NpfsWaiterThread,
|
||||
(PVOID)ThreadContext);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(ThreadContext);
|
||||
KeUnlockMutex(&DeviceExt->PipeListLock);
|
||||
return Status;
|
||||
}
|
||||
InsertHeadList(&DeviceExt->ThreadListHead, &ThreadContext->ListEntry);
|
||||
DeviceExt->EmptyWaiterCount += MAXIMUM_WAIT_OBJECTS - 1;
|
||||
}
|
||||
IoMarkIrpPending(Context->Irp);
|
||||
Context->Irp->Tail.Overlay.DriverContext[0] = Context;
|
||||
|
||||
IoAcquireCancelSpinLock(&oldIrql);
|
||||
if (Context->Irp->Cancel)
|
||||
{
|
||||
IoReleaseCancelSpinLock(oldIrql);
|
||||
Status = STATUS_CANCELLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
IoSetCancelRoutine(Context->Irp, NpfsWaitingCancelRoutine);
|
||||
IoReleaseCancelSpinLock(oldIrql);
|
||||
ThreadContext->WaitObjectArray[ThreadContext->Count] = &Fcb->Event;
|
||||
ThreadContext->WaitContextArray[ThreadContext->Count] = Context;
|
||||
ThreadContext->Count++;
|
||||
DeviceExt->EmptyWaiterCount--;
|
||||
KeSetEvent(&ThreadContext->Event, IO_NO_INCREMENT, FALSE);
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
KeUnlockMutex(&DeviceExt->PipeListLock);
|
||||
return Status;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
NpfsReadFromPipe(PNPFS_CONTEXT Context)
|
||||
{
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
PFILE_OBJECT FileObject;
|
||||
NTSTATUS Status;
|
||||
PNPFS_DEVICE_EXTENSION DeviceExt;
|
||||
KIRQL OldIrql;
|
||||
ULONG Information;
|
||||
PNPFS_FCB Fcb;
|
||||
PNPFS_FCB WriterFcb;
|
||||
@@ -65,23 +246,14 @@ NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
ULONG CopyLength;
|
||||
ULONG TempLength;
|
||||
|
||||
DPRINT("NpfsRead(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
|
||||
DPRINT("NpfsReadFromPipe(Context %p)\n", Context);
|
||||
|
||||
DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
IoStack = IoGetCurrentIrpStackLocation(Context->Irp);
|
||||
FileObject = IoStack->FileObject;
|
||||
Fcb = FileObject->FsContext;
|
||||
Pipe = Fcb->Pipe;
|
||||
WriterFcb = Fcb->OtherSide;
|
||||
|
||||
if (Irp->MdlAddress == NULL)
|
||||
{
|
||||
DPRINT("Irp->MdlAddress == NULL\n");
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
Information = 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (Fcb->Data == NULL)
|
||||
{
|
||||
DPRINT("Pipe is NOT readable!\n");
|
||||
@@ -94,18 +266,17 @@ NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
Length = IoStack->Parameters.Read.Length;
|
||||
Information = 0;
|
||||
|
||||
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||
KeAcquireSpinLock(&Fcb->DataListLock, &OldIrql);
|
||||
Buffer = MmGetSystemAddressForMdl(Context->Irp->MdlAddress);
|
||||
ExAcquireFastMutex(&Fcb->DataListLock);
|
||||
while (1)
|
||||
{
|
||||
/* FIXME: check if in blocking mode */
|
||||
if (Fcb->ReadDataAvailable == 0)
|
||||
{
|
||||
if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
|
||||
{
|
||||
KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
KeReleaseSpinLock(&Fcb->DataListLock, OldIrql);
|
||||
ExReleaseFastMutex(&Fcb->DataListLock);
|
||||
if (Information > 0)
|
||||
{
|
||||
Status = STATUS_SUCCESS;
|
||||
@@ -119,16 +290,46 @@ NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Wait for ReadEvent to become signaled */
|
||||
DPRINT("Waiting for readable data (%S)\n", Pipe->PipeName.Buffer);
|
||||
Status = KeWaitForSingleObject(&Fcb->Event,
|
||||
UserRequest,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL);
|
||||
DPRINT("Finished waiting (%S)! Status: %x\n", Pipe->PipeName.Buffer, Status);
|
||||
if (IoIsOperationSynchronous(Context->Irp))
|
||||
{
|
||||
/* Wait for ReadEvent to become signaled */
|
||||
DPRINT("Waiting for readable data (%S)\n", Pipe->PipeName.Buffer);
|
||||
Status = KeWaitForSingleObject(&Fcb->Event,
|
||||
UserRequest,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL);
|
||||
DPRINT("Finished waiting (%S)! Status: %x\n", Pipe->PipeName.Buffer, Status);
|
||||
}
|
||||
else
|
||||
{
|
||||
PNPFS_CONTEXT NewContext;
|
||||
|
||||
KeAcquireSpinLock(&Fcb->DataListLock, &OldIrql);
|
||||
NewContext = ExAllocatePool(NonPagedPool, sizeof(NPFS_CONTEXT));
|
||||
if (NewContext == NULL)
|
||||
{
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
memcpy(NewContext, Context, sizeof(NPFS_CONTEXT));
|
||||
NewContext->AllocatedFromPool = TRUE;
|
||||
NewContext->Fcb = Fcb;
|
||||
NewContext->MajorFunction = IRP_MJ_READ;
|
||||
|
||||
Status = NpfsAddWaitingReader(Context->DeviceObject->DeviceExtension, NewContext, Fcb);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = STATUS_PENDING;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExFreePool(NewContext);
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
ExAcquireFastMutex(&Fcb->DataListLock);
|
||||
}
|
||||
|
||||
if (Pipe->ReadMode == FILE_PIPE_BYTE_STREAM_MODE)
|
||||
@@ -217,19 +418,47 @@ NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
}
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&Fcb->DataListLock, OldIrql);
|
||||
ExReleaseFastMutex(&Fcb->DataListLock);
|
||||
|
||||
done:
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = Information;
|
||||
Context->Irp->IoStatus.Status = Status;
|
||||
Context->Irp->IoStatus.Information = Information;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
if (Status != STATUS_PENDING)
|
||||
{
|
||||
IoCompleteRequest(Context->Irp, IO_NO_INCREMENT);
|
||||
}
|
||||
|
||||
if (Context->AllocatedFromPool)
|
||||
{
|
||||
ExFreePool(Context);
|
||||
}
|
||||
DPRINT("NpfsRead done (Status %lx)\n", Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
NPFS_CONTEXT Context;
|
||||
|
||||
Context.AllocatedFromPool = FALSE;
|
||||
Context.DeviceObject = DeviceObject;
|
||||
Context.Irp = Irp;
|
||||
|
||||
if (Irp->MdlAddress == NULL)
|
||||
{
|
||||
DPRINT("Irp->MdlAddress == NULL\n");
|
||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
return NpfsReadFromPipe(&Context);
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
@@ -244,7 +473,6 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
ULONG Length;
|
||||
ULONG Offset;
|
||||
KIRQL OldIrql;
|
||||
ULONG Information;
|
||||
ULONG CopyLength;
|
||||
ULONG TempLength;
|
||||
@@ -296,7 +524,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_SUCCESS;
|
||||
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
|
||||
|
||||
KeAcquireSpinLock(&ReaderFcb->DataListLock, &OldIrql);
|
||||
ExAcquireFastMutex(&ReaderFcb->DataListLock);
|
||||
#ifndef NDEBUG
|
||||
DPRINT("Length %d Buffer %x Offset %x\n",Length,Buffer,Offset);
|
||||
HexDump(Buffer, Length);
|
||||
@@ -307,7 +535,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
if (ReaderFcb->WriteQuotaAvailable == 0)
|
||||
{
|
||||
KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
KeReleaseSpinLock(&ReaderFcb->DataListLock, OldIrql);
|
||||
ExReleaseFastMutex(&ReaderFcb->DataListLock);
|
||||
if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE)
|
||||
{
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
@@ -332,7 +560,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
goto done;
|
||||
}
|
||||
KeAcquireSpinLock(&ReaderFcb->DataListLock, &OldIrql);
|
||||
ExAcquireFastMutex(&ReaderFcb->DataListLock);
|
||||
}
|
||||
|
||||
if (Pipe->WriteMode == FILE_PIPE_BYTE_STREAM_MODE)
|
||||
@@ -395,7 +623,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
}
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&ReaderFcb->DataListLock, OldIrql);
|
||||
ExReleaseFastMutex(&ReaderFcb->DataListLock);
|
||||
|
||||
done:
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
@@ -268,69 +268,65 @@ VfatSetDispositionInformation(PFILE_OBJECT FileObject,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_DISPOSITION_INFORMATION DispositionInfo)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
#ifdef DBG
|
||||
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
|
||||
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
|
||||
#endif
|
||||
|
||||
DPRINT ("FsdSetDispositionInformation()\n");
|
||||
DPRINT ("FsdSetDispositionInformation()\n");
|
||||
|
||||
ASSERT(DeviceExt != NULL);
|
||||
ASSERT(DeviceExt->FatInfo.BytesPerCluster != 0);
|
||||
ASSERT(FCB != NULL);
|
||||
ASSERT(DeviceExt != NULL);
|
||||
ASSERT(DeviceExt->FatInfo.BytesPerCluster != 0);
|
||||
ASSERT(FCB != NULL);
|
||||
|
||||
if (*FCB->Attributes & FILE_ATTRIBUTE_READONLY)
|
||||
{
|
||||
if (!DispositionInfo->DeleteFile)
|
||||
{
|
||||
/* undelete the file */
|
||||
FCB->Flags &= ~FCB_DELETE_PENDING;
|
||||
FileObject->DeletePending = FALSE;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (FCB->Flags & FCB_DELETE_PENDING)
|
||||
{
|
||||
/* stream already marked for deletion. just update the file object */
|
||||
FileObject->DeletePending = TRUE;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (*FCB->Attributes & FILE_ATTRIBUTE_READONLY)
|
||||
{
|
||||
return STATUS_CANNOT_DELETE;
|
||||
}
|
||||
}
|
||||
|
||||
if (vfatFCBIsRoot(FCB) ||
|
||||
if (vfatFCBIsRoot(FCB) ||
|
||||
(FCB->LongNameU.Length == sizeof(WCHAR) && FCB->LongNameU.Buffer[0] == L'.') ||
|
||||
(FCB->LongNameU.Length == 2 * sizeof(WCHAR) && FCB->LongNameU.Buffer[0] == L'.' && FCB->LongNameU.Buffer[1] == L'.'))
|
||||
{
|
||||
{
|
||||
// we cannot delete a '.', '..' or the root directory
|
||||
return STATUS_ACCESS_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
if (DispositionInfo->DeleteFile)
|
||||
{
|
||||
if (MmFlushImageSection (FileObject->SectionObjectPointer, MmFlushForDelete))
|
||||
{
|
||||
if (FCB->OpenHandleCount > 1)
|
||||
{
|
||||
DPRINT1("%d %x\n", FCB->OpenHandleCount, CcGetFileObjectFromSectionPtrs(FileObject->SectionObjectPointer));
|
||||
Status = STATUS_ACCESS_DENIED;
|
||||
}
|
||||
else
|
||||
{
|
||||
FCB->Flags |= FCB_DELETE_PENDING;
|
||||
FileObject->DeletePending = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("MmFlushImageSection returned FALSE\n");
|
||||
Status = STATUS_CANNOT_DELETE;
|
||||
}
|
||||
if (NT_SUCCESS(Status) && vfatFCBIsDirectory(FCB))
|
||||
{
|
||||
if (!VfatIsDirectoryEmpty(FCB))
|
||||
{
|
||||
Status = STATUS_DIRECTORY_NOT_EMPTY;
|
||||
FCB->Flags &= ~FCB_DELETE_PENDING;
|
||||
FileObject->DeletePending = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FileObject->DeletePending = FALSE;
|
||||
}
|
||||
return Status;
|
||||
|
||||
if (!MmFlushImageSection (FileObject->SectionObjectPointer, MmFlushForDelete))
|
||||
{
|
||||
/* can't delete a file if its mapped into a process */
|
||||
|
||||
DPRINT("MmFlushImageSection returned FALSE\n");
|
||||
return STATUS_CANNOT_DELETE;
|
||||
}
|
||||
|
||||
if (vfatFCBIsDirectory(FCB) && !VfatIsDirectoryEmpty(FCB))
|
||||
{
|
||||
/* can't delete a non-empty directory */
|
||||
|
||||
return STATUS_DIRECTORY_NOT_EMPTY;
|
||||
}
|
||||
|
||||
/* all good */
|
||||
FCB->Flags |= FCB_DELETE_PENDING;
|
||||
FileObject->DeletePending = TRUE;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
|
@@ -441,7 +441,7 @@ KbdDpcRoutine(PKDPC Dpc,
|
||||
|
||||
if (SystemArgument1 == NULL && DoSystemDebug != -1)
|
||||
{
|
||||
if (KbdWorkItem != NULL)
|
||||
if (KbdWorkItem != NULL && DoSystemDebug == 10) /* 10 is Tab + K (enter kernel debugger) */
|
||||
{
|
||||
IoQueueWorkItem(KbdWorkItem, (PIO_WORKITEM_ROUTINE)KbdWorkItemRoutine, DelayedWorkQueue, NULL);
|
||||
}
|
||||
|
@@ -209,3 +209,28 @@ PIP_INTERFACE FindOnLinkInterface(PIP_ADDRESS Address)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NTSTATUS GetInterfaceConnectionStatus
|
||||
( PIP_INTERFACE Interface, PDWORD Result ) {
|
||||
NTSTATUS Status = TcpipLanGetDwordOid
|
||||
( Interface, OID_GEN_HARDWARE_STATUS, Result );
|
||||
if( NT_SUCCESS(Status) ) switch( *Result ) {
|
||||
case NdisHardwareStatusReady:
|
||||
*Result = MIB_IF_OPER_STATUS_OPERATIONAL;
|
||||
break;
|
||||
case NdisHardwareStatusInitializing:
|
||||
*Result = MIB_IF_OPER_STATUS_CONNECTING;
|
||||
break;
|
||||
case NdisHardwareStatusReset:
|
||||
*Result = MIB_IF_OPER_STATUS_DISCONNECTED;
|
||||
break;
|
||||
case NdisHardwareStatusNotReady:
|
||||
*Result = MIB_IF_OPER_STATUS_DISCONNECTED;
|
||||
break;
|
||||
case NdisHardwareStatusClosing:
|
||||
default:
|
||||
*Result = MIB_IF_OPER_STATUS_NON_OPERATIONAL;
|
||||
break;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
@@ -244,13 +244,29 @@ BOOLEAN IPRegisterInterface(
|
||||
*/
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
UINT ChosenIndex = 1;
|
||||
BOOLEAN IndexHasBeenChosen;
|
||||
IP_ADDRESS NetworkAddress;
|
||||
PNEIGHBOR_CACHE_ENTRY NCE;
|
||||
IF_LIST_ITER(Interface);
|
||||
|
||||
TI_DbgPrint(MID_TRACE, ("Called. IF (0x%X).\n", IF));
|
||||
|
||||
TcpipAcquireSpinLock(&IF->Lock, &OldIrql);
|
||||
|
||||
/* Choose an index */
|
||||
do {
|
||||
IndexHasBeenChosen = TRUE;
|
||||
ForEachInterface(Interface) {
|
||||
if( Interface->Index == ChosenIndex ) {
|
||||
ChosenIndex++;
|
||||
IndexHasBeenChosen = FALSE;
|
||||
}
|
||||
} EndFor(Interface);
|
||||
} while( !IndexHasBeenChosen );
|
||||
|
||||
IF->Index = ChosenIndex;
|
||||
|
||||
/* Add a permanent neighbor for this NTE */
|
||||
NCE = NBAddNeighbor(IF, &IF->Unicast,
|
||||
IF->Address, IF->AddressLength,
|
||||
|
@@ -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;
|
||||
|
@@ -165,6 +165,28 @@ VOID FreeAdapter(
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS TcpipLanGetDwordOid
|
||||
( PIP_INTERFACE Interface,
|
||||
NDIS_OID Oid,
|
||||
PDWORD Result ) {
|
||||
/* Get maximum frame size */
|
||||
if( Interface->Context ) {
|
||||
return NDISCall((PLAN_ADAPTER)Interface->Context,
|
||||
NdisRequestQueryInformation,
|
||||
Oid,
|
||||
Result,
|
||||
sizeof(DWORD));
|
||||
} else switch( Oid ) { /* Loopback Case */
|
||||
case OID_GEN_HARDWARE_STATUS:
|
||||
*Result = NdisHardwareStatusReady;
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
default:
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID STDCALL ProtocolOpenAdapterComplete(
|
||||
NDIS_HANDLE BindingContext,
|
||||
NDIS_STATUS Status,
|
||||
@@ -916,11 +938,10 @@ VOID BindAdapter(
|
||||
TI_DbgPrint(MID_TRACE,("BCAST(IF) %s\n", A2S(&IF->Broadcast)));
|
||||
|
||||
if(NT_SUCCESS(Status)) {
|
||||
RtlZeroMemory( &IF->Name, sizeof(IF->Name) );
|
||||
Status = ReadStringFromRegistry( RegHandle, L"DeviceDesc",
|
||||
&IF->Name );
|
||||
|
||||
RtlZeroMemory( &IF->Name, sizeof( IF->Name ) );
|
||||
|
||||
/* I think that not getting a devicedesc is not a fatal error */
|
||||
if( !NT_SUCCESS(Status) ) {
|
||||
if( IF->Name.Buffer ) exFreePool( IF->Name.Buffer );
|
||||
@@ -929,6 +950,8 @@ VOID BindAdapter(
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
TI_DbgPrint(MID_TRACE,("Adapter Name: %wZ\n", &IF->Name));
|
||||
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
TI_DbgPrint(MIN_TRACE, ("Unable to open protocol-specific registry key: 0x%x\n", Status));
|
||||
|
@@ -56,6 +56,14 @@ NTSTATUS DispTdiSetInformationEx(
|
||||
PIRP Irp,
|
||||
PIO_STACK_LOCATION IrpSp);
|
||||
|
||||
NTSTATUS DispTdiSetIPAddress(
|
||||
PIRP Irp,
|
||||
PIO_STACK_LOCATION IrpSp);
|
||||
|
||||
NTSTATUS DispTdiDeleteIPAddress(
|
||||
PIRP Irp,
|
||||
PIO_STACK_LOCATION IrpSp);
|
||||
|
||||
#endif /* __DISPATCH_H */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -13,6 +13,8 @@ UINT CountInterfaceAddresses( PIP_INTERFACE Interface );
|
||||
NTSTATUS GetInterfaceSpeed( PIP_INTERFACE Interface, PUINT Speed );
|
||||
NTSTATUS GetInterfaceName( PIP_INTERFACE Interface, PCHAR NameBuffer,
|
||||
UINT NameMaxLen );
|
||||
NTSTATUS GetInterfaceConnectionStatus( PIP_INTERFACE Interface,
|
||||
PDWORD OperStatus );
|
||||
PIP_INTERFACE FindOnLinkInterface(PIP_ADDRESS Address);
|
||||
|
||||
#endif//_TCPIP_INTERFACE_H
|
||||
|
@@ -153,10 +153,16 @@ typedef struct _IP_INTERFACE {
|
||||
UNICODE_STRING Name; /* Adapter name */
|
||||
PUCHAR Address; /* Pointer to interface address */
|
||||
UINT AddressLength; /* Length of address in bytes */
|
||||
UINT Index; /* Index of adapter (used to add ip addr) */
|
||||
LL_TRANSMIT_ROUTINE Transmit; /* Pointer to transmit function */
|
||||
PVOID TCPContext; /* TCP Content for this interface */
|
||||
} IP_INTERFACE, *PIP_INTERFACE;
|
||||
|
||||
typedef struct _IP_SET_ADDRESS {
|
||||
ULONG NteIndex;
|
||||
IPv4_RAW_ADDRESS Address;
|
||||
IPv4_RAW_ADDRESS Netmask;
|
||||
} IP_SET_ADDRESS, *PIP_SET_ADDRESS;
|
||||
|
||||
#define IP_PROTOCOL_TABLE_SIZE 0x100
|
||||
|
||||
|
@@ -98,6 +98,9 @@ VOID LANUnregisterProtocol(
|
||||
VOID LANStartup();
|
||||
VOID LANShutdown();
|
||||
|
||||
NTSTATUS TcpipLanGetDwordOid( PIP_INTERFACE Interface, NDIS_OID Oid,
|
||||
PDWORD Result );
|
||||
|
||||
NDIS_STATUS NDISCall(
|
||||
PLAN_ADAPTER Adapter,
|
||||
NDIS_REQUEST_TYPE Type,
|
||||
|
@@ -35,5 +35,6 @@
|
||||
#include <oskittcp.h>
|
||||
#include <interface.h>
|
||||
#include <ports.h>
|
||||
#include <ipifcons.h>
|
||||
#define NTOS_MODE_USER
|
||||
#include <ntos.h>
|
||||
|
@@ -136,7 +136,7 @@ typedef struct {
|
||||
} TDIEntityInfo;
|
||||
|
||||
#ifndef htons
|
||||
#define htons(x) (((x) << 16) | (((x) >> 8) & 0xff))
|
||||
#define htons(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
|
||||
#endif
|
||||
|
||||
/* Global variable */
|
||||
|
@@ -45,6 +45,12 @@
|
||||
#define IOCTL_TCP_SET_INFORMATION_EX \
|
||||
_TCP_CTL_CODE(1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
|
||||
#define IOCTL_SET_IP_ADDRESS \
|
||||
_TCP_CTL_CODE(14, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
|
||||
#define IOCTL_DELETE_IP_ADDRESS \
|
||||
_TCP_CTL_CODE(16, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
|
||||
/* Unique error values for log entries */
|
||||
#define TI_ERROR_DRIVERENTRY 0
|
||||
|
||||
|
@@ -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
|
||||
@@ -1413,4 +1465,56 @@ NTSTATUS DispTdiSetInformationEx(
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* TODO: Support multiple addresses per interface.
|
||||
* For now just set the nte context to the interface index.
|
||||
*
|
||||
* Later on, create an NTE context and NTE instance
|
||||
*/
|
||||
|
||||
NTSTATUS DispTdiSetIPAddress( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
|
||||
NTSTATUS Status = STATUS_DEVICE_DOES_NOT_EXIST;
|
||||
PIP_SET_ADDRESS IpAddrChange =
|
||||
(PIP_SET_ADDRESS)Irp->AssociatedIrp.SystemBuffer;
|
||||
IF_LIST_ITER(IF);
|
||||
|
||||
ForEachInterface(IF) {
|
||||
if( IF->Unicast.Address.IPv4Address == IpAddrChange->Address ) {
|
||||
Status = STATUS_DUPLICATE_OBJECTID;
|
||||
break;
|
||||
}
|
||||
if( IF->Index == IpAddrChange->NteIndex ) {
|
||||
IF->Unicast.Type = IP_ADDRESS_V4;
|
||||
IF->Unicast.Address.IPv4Address = IpAddrChange->Address;
|
||||
IF->Netmask.Type = IP_ADDRESS_V4;
|
||||
IF->Netmask.Address.IPv4Address = IpAddrChange->Netmask;
|
||||
IpAddrChange->Address = IF->Index;
|
||||
Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = IF->Index;
|
||||
break;
|
||||
}
|
||||
} EndFor(IF);
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS DispTdiDeleteIPAddress( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
|
||||
NTSTATUS Status = STATUS_UNSUCCESSFUL;
|
||||
PUSHORT NteIndex = Irp->AssociatedIrp.SystemBuffer;
|
||||
IF_LIST_ITER(IF);
|
||||
|
||||
ForEachInterface(IF) {
|
||||
if( IF->Index == *NteIndex ) {
|
||||
IF->Unicast.Type = IP_ADDRESS_V4;
|
||||
IF->Unicast.Address.IPv4Address = 0;
|
||||
IF->Netmask.Type = IP_ADDRESS_V4;
|
||||
IF->Netmask.Address.IPv4Address = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
} EndFor(IF);
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
@@ -33,15 +33,21 @@ TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID *ID,
|
||||
|
||||
RtlZeroMemory( OutData, sizeof(IFENTRY) + MAX_IFDESCR_LEN );
|
||||
|
||||
OutData->Index = ID->tei_instance + 1;
|
||||
OutData->Index = Interface->Index;
|
||||
/* viz: tcpip keeps those indices */
|
||||
OutData->Type = Interface == Loopback ? IFENT_SOFTWARE_LOOPBACK : 0;
|
||||
OutData->Type = Interface ==
|
||||
Loopback ? MIB_IF_TYPE_LOOPBACK : MIB_IF_TYPE_ETHERNET;
|
||||
OutData->Mtu = Interface->MTU;
|
||||
TI_DbgPrint(MAX_TRACE,
|
||||
("Getting interface speed\n"));
|
||||
OutData->PhysAddrLen = Interface->AddressLength;
|
||||
OutData->AdminStatus = 1; /* XXX Up -- How do I know? */
|
||||
OutData->OperStatus = 1; /* XXX Up -- How do I know? */
|
||||
OutData->AdminStatus = MIB_IF_ADMIN_STATUS_UP;
|
||||
/* NDIS_HARDWARE_STATUS -> ROUTER_CONNECTION_STATE */
|
||||
Status = GetInterfaceConnectionStatus( Interface, &OutData->OperStatus );
|
||||
|
||||
/* Not sure what to do here, but not ready seems a safe bet on failure */
|
||||
if( !NT_SUCCESS(Status) )
|
||||
OutData->OperStatus = NdisHardwareStatusNotReady;
|
||||
|
||||
IFDescr = (PCHAR)&OutData[1];
|
||||
|
||||
@@ -98,5 +104,7 @@ TDI_STATUS InfoInterfaceTdiSetEx( UINT InfoClass,
|
||||
TDIEntityID *id,
|
||||
PCHAR Buffer,
|
||||
UINT BufferSize ) {
|
||||
TI_DbgPrint(MAX_TRACE, ("Got Request: Class %x Type %x Id %x, EntityID %x:%x\n",
|
||||
InfoClass, InfoId, id->tei_entity, id->tei_instance));
|
||||
return TDI_INVALID_REQUEST;
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
#include "precomp.h"
|
||||
|
||||
#define NDEBUG
|
||||
//#define NDEBUG
|
||||
|
||||
#ifndef NDEBUG
|
||||
DWORD DebugTraceLevel = DEBUG_ULTRA & ~(DEBUG_LOCK | DEBUG_PBUFFER);
|
||||
@@ -578,6 +578,16 @@ TiDispatch(
|
||||
Status = DispTdiSetInformationEx(Irp, IrpSp);
|
||||
break;
|
||||
|
||||
case IOCTL_SET_IP_ADDRESS:
|
||||
TI_DbgPrint(MIN_TRACE, ("SET_IP_ADDRESS\n"));
|
||||
Status = DispTdiSetIPAddress(Irp, IrpSp);
|
||||
break;
|
||||
|
||||
case IOCTL_DELETE_IP_ADDRESS:
|
||||
TI_DbgPrint(MIN_TRACE, ("DELETE_IP_ADDRESS\n"));
|
||||
Status = DispTdiDeleteIPAddress(Irp, IrpSp);
|
||||
break;
|
||||
|
||||
default:
|
||||
TI_DbgPrint(MIN_TRACE, ("Unknown IOCTL 0x%X\n",
|
||||
IrpSp->Parameters.DeviceIoControl.IoControlCode));
|
||||
|
@@ -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;
|
||||
|
@@ -329,6 +329,10 @@ IntVideoPortPnPStartDevice(
|
||||
{
|
||||
DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
|
||||
DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
|
||||
if (Descriptor->ShareDisposition == CmResourceShareShared)
|
||||
DeviceExtension->InterruptShared = TRUE;
|
||||
else
|
||||
DeviceExtension->InterruptShared = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -85,7 +85,7 @@ IntVideoPortSetupInterrupt(
|
||||
Irql,
|
||||
Irql,
|
||||
ConfigInfo->InterruptMode,
|
||||
FALSE,
|
||||
DeviceExtension->InterruptShared,
|
||||
Affinity,
|
||||
FALSE);
|
||||
|
||||
|
@@ -559,6 +559,10 @@ VideoPortGetAccessRanges(
|
||||
{
|
||||
DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
|
||||
DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
|
||||
if (Descriptor->ShareDisposition == CmResourceShareShared)
|
||||
DeviceExtension->InterruptShared = TRUE;
|
||||
else
|
||||
DeviceExtension->InterruptShared = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -492,7 +492,7 @@ IntVideoPortFindAdapter(
|
||||
|
||||
VOID FASTCALL
|
||||
IntAttachToCSRSS(PEPROCESS *CallingProcess, PEPROCESS *PrevAttachedProcess)
|
||||
{
|
||||
{
|
||||
*CallingProcess = PsGetCurrentProcess();
|
||||
if (*CallingProcess != Csrss)
|
||||
{
|
||||
|
@@ -93,6 +93,7 @@ typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
|
||||
PCM_RESOURCE_LIST AllocatedResources;
|
||||
ULONG InterruptVector;
|
||||
ULONG InterruptLevel;
|
||||
BOOLEAN InterruptShared;
|
||||
ULONG AdapterInterfaceType;
|
||||
ULONG SystemIoBusNumber;
|
||||
ULONG SystemIoSlotNumber;
|
||||
|
@@ -502,7 +502,7 @@ HalRestoreFont(VOID)
|
||||
HalWriteGc(0x05, 0x00); /* Write mode 0; read mode 0. */
|
||||
HalWriteGc(0x06, 0x05); /* Set graphics. */
|
||||
memcpy(GraphVideoBuffer, SavedTextFont[i], FONT_AMOUNT);
|
||||
}
|
||||
}
|
||||
|
||||
HalBlankScreen(TRUE);
|
||||
|
||||
@@ -519,7 +519,6 @@ HalRestoreFont(VOID)
|
||||
HalWriteSeq(0x04, Seq4);
|
||||
}
|
||||
|
||||
|
||||
VOID STATIC
|
||||
HalRestoreMode(VOID)
|
||||
{
|
||||
@@ -629,6 +628,7 @@ HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* PUBLIC FUNCTIONS *********************************************************/
|
||||
|
||||
VOID STDCALL
|
||||
@@ -637,7 +637,6 @@ HalReleaseDisplayOwnership(VOID)
|
||||
* FUNCTION: Release ownership of display back to HAL
|
||||
*/
|
||||
{
|
||||
|
||||
if (HalResetDisplayParameters == NULL)
|
||||
return;
|
||||
|
||||
@@ -646,14 +645,12 @@ HalReleaseDisplayOwnership(VOID)
|
||||
|
||||
if (!HalResetDisplayParameters(SizeX, SizeY))
|
||||
{
|
||||
|
||||
HalRestoreMode();
|
||||
HalRestoreFont();
|
||||
HalRestorePalette();
|
||||
HalRestorePalette();
|
||||
}
|
||||
HalOwnsDisplay = TRUE;
|
||||
HalClearDisplay(CHAR_ATTRIBUTE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
1132
reactos/include/d3d8.h
Normal file
1132
reactos/include/d3d8.h
Normal file
File diff suppressed because it is too large
Load Diff
286
reactos/include/d3d8caps.h
Normal file
286
reactos/include/d3d8caps.h
Normal file
@@ -0,0 +1,286 @@
|
||||
/*
|
||||
* Copyright (C) 2002 Jason Edmeades
|
||||
*
|
||||
* 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_D3D8CAPS_H
|
||||
#define __WINE_D3D8CAPS_H
|
||||
|
||||
/*
|
||||
* Definitions
|
||||
*/
|
||||
|
||||
#define D3DCAPS_READ_SCANLINE 0x20000
|
||||
|
||||
#define D3DCURSORCAPS_COLOR 1
|
||||
#define D3DCURSORCAPS_LOWRES 2
|
||||
|
||||
#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x0000010
|
||||
#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x0000020
|
||||
#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x0000040
|
||||
#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x0000080
|
||||
#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x0000100
|
||||
#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x0000200
|
||||
#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x0000400
|
||||
#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x0000800
|
||||
#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x0001000
|
||||
#define D3DDEVCAPS_DRAWPRIMITIVES2 0x0002000
|
||||
#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x0004000
|
||||
#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x0008000
|
||||
#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x0010000
|
||||
#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x0020000
|
||||
#define D3DDEVCAPS_HWRASTERIZATION 0x0080000
|
||||
#define D3DDEVCAPS_PUREDEVICE 0x0100000
|
||||
#define D3DDEVCAPS_QUINTICRTPATCHES 0x0200000
|
||||
#define D3DDEVCAPS_RTPATCHES 0x0400000
|
||||
#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x0800000
|
||||
#define D3DDEVCAPS_NPATCHES 0x1000000
|
||||
|
||||
#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x00FFFF
|
||||
#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x080000
|
||||
#define D3DFVFCAPS_PSIZE 0x100000
|
||||
|
||||
#define D3DLINECAPS_TEXTURE 0x01
|
||||
#define D3DLINECAPS_ZTEST 0x02
|
||||
#define D3DLINECAPS_BLEND 0x04
|
||||
#define D3DLINECAPS_ALPHACMP 0x08
|
||||
#define D3DLINECAPS_FOG 0x10
|
||||
|
||||
#define D3DPBLENDCAPS_ZERO 0x0001
|
||||
#define D3DPBLENDCAPS_ONE 0x0002
|
||||
#define D3DPBLENDCAPS_SRCCOLOR 0x0004
|
||||
#define D3DPBLENDCAPS_INVSRCCOLOR 0x0008
|
||||
#define D3DPBLENDCAPS_SRCALPHA 0x0010
|
||||
#define D3DPBLENDCAPS_INVSRCALPHA 0x0020
|
||||
#define D3DPBLENDCAPS_DESTALPHA 0x0040
|
||||
#define D3DPBLENDCAPS_INVDESTALPHA 0x0080
|
||||
#define D3DPBLENDCAPS_DESTCOLOR 0x0100
|
||||
#define D3DPBLENDCAPS_INVDESTCOLOR 0x0200
|
||||
#define D3DPBLENDCAPS_SRCALPHASAT 0x0400
|
||||
#define D3DPBLENDCAPS_BOTHSRCALPHA 0x0800
|
||||
#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x1000
|
||||
|
||||
#define D3DPCMPCAPS_NEVER 0x01
|
||||
#define D3DPCMPCAPS_LESS 0x02
|
||||
#define D3DPCMPCAPS_EQUAL 0x04
|
||||
#define D3DPCMPCAPS_LESSEQUAL 0x08
|
||||
#define D3DPCMPCAPS_GREATER 0x10
|
||||
#define D3DPCMPCAPS_NOTEQUAL 0x20
|
||||
#define D3DPCMPCAPS_GREATEREQUAL 0x40
|
||||
#define D3DPCMPCAPS_ALWAYS 0x80
|
||||
|
||||
#define D3DPMISCCAPS_MASKZ 0x0002
|
||||
#define D3DPMISCCAPS_LINEPATTERNREP 0x0004
|
||||
#define D3DPMISCCAPS_CULLNONE 0x0010
|
||||
#define D3DPMISCCAPS_CULLCW 0x0020
|
||||
#define D3DPMISCCAPS_CULLCCW 0x0040
|
||||
#define D3DPMISCCAPS_COLORWRITEENABLE 0x0080
|
||||
#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x0100
|
||||
#define D3DPMISCCAPS_CLIPTLVERTS 0x0200
|
||||
#define D3DPMISCCAPS_TSSARGTEMP 0x0400
|
||||
#define D3DPMISCCAPS_BLENDOP 0x0800
|
||||
|
||||
#define D3DPRASTERCAPS_DITHER 0x00000001
|
||||
#define D3DPRASTERCAPS_PAT 0x00000008
|
||||
#define D3DPRASTERCAPS_ZTEST 0x00000010
|
||||
#define D3DPRASTERCAPS_FOGVERTEX 0x00000080
|
||||
#define D3DPRASTERCAPS_FOGTABLE 0x00000100
|
||||
#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000
|
||||
#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000
|
||||
#define D3DPRASTERCAPS_ZBIAS 0x00004000
|
||||
#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000
|
||||
#define D3DPRASTERCAPS_FOGRANGE 0x00010000
|
||||
#define D3DPRASTERCAPS_ANISOTROPY 0x00020000
|
||||
#define D3DPRASTERCAPS_WBUFFER 0x00040000
|
||||
#define D3DPRASTERCAPS_WFOG 0x00100000
|
||||
#define D3DPRASTERCAPS_ZFOG 0x00200000
|
||||
#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000
|
||||
#define D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE 0x00800000
|
||||
|
||||
#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000
|
||||
#define D3DPRESENT_INTERVAL_ONE 0x00000001
|
||||
#define D3DPRESENT_INTERVAL_TWO 0x00000002
|
||||
#define D3DPRESENT_INTERVAL_THREE 0x00000004
|
||||
#define D3DPRESENT_INTERVAL_FOUR 0x00000008
|
||||
#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000
|
||||
|
||||
#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00008
|
||||
#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00200
|
||||
#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x04000
|
||||
#define D3DPSHADECAPS_FOGGOURAUD 0x80000
|
||||
|
||||
#define D3DPTADDRESSCAPS_WRAP 0x01
|
||||
#define D3DPTADDRESSCAPS_MIRROR 0x02
|
||||
#define D3DPTADDRESSCAPS_CLAMP 0x04
|
||||
#define D3DPTADDRESSCAPS_BORDER 0x08
|
||||
#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x10
|
||||
#define D3DPTADDRESSCAPS_MIRRORONCE 0x20
|
||||
|
||||
#define D3DPTEXTURECAPS_PERSPECTIVE 0x00001
|
||||
#define D3DPTEXTURECAPS_POW2 0x00002
|
||||
#define D3DPTEXTURECAPS_ALPHA 0x00004
|
||||
#define D3DPTEXTURECAPS_SQUAREONLY 0x00020
|
||||
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00040
|
||||
#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00080
|
||||
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00100
|
||||
#define D3DPTEXTURECAPS_PROJECTED 0x00400
|
||||
#define D3DPTEXTURECAPS_CUBEMAP 0x00800
|
||||
#define D3DPTEXTURECAPS_VOLUMEMAP 0x02000
|
||||
#define D3DPTEXTURECAPS_MIPMAP 0x04000
|
||||
#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x08000
|
||||
#define D3DPTEXTURECAPS_MIPCUBEMAP 0x10000
|
||||
#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x20000
|
||||
#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x40000
|
||||
|
||||
#define D3DPTFILTERCAPS_MINFPOINT 0x00000100
|
||||
#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200
|
||||
#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400
|
||||
#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000
|
||||
#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000
|
||||
#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000
|
||||
#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000
|
||||
#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000
|
||||
#define D3DPTFILTERCAPS_MAGFAFLATCUBIC 0x08000000
|
||||
#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC 0x10000000
|
||||
|
||||
#define D3DSTENCILCAPS_KEEP 0x01
|
||||
#define D3DSTENCILCAPS_ZERO 0x02
|
||||
#define D3DSTENCILCAPS_REPLACE 0x04
|
||||
#define D3DSTENCILCAPS_INCRSAT 0x08
|
||||
#define D3DSTENCILCAPS_DECRSAT 0x10
|
||||
#define D3DSTENCILCAPS_INVERT 0x20
|
||||
#define D3DSTENCILCAPS_INCR 0x40
|
||||
#define D3DSTENCILCAPS_DECR 0x80
|
||||
|
||||
#define D3DTEXOPCAPS_DISABLE 0x0000001
|
||||
#define D3DTEXOPCAPS_SELECTARG1 0x0000002
|
||||
#define D3DTEXOPCAPS_SELECTARG2 0x0000004
|
||||
#define D3DTEXOPCAPS_MODULATE 0x0000008
|
||||
#define D3DTEXOPCAPS_MODULATE2X 0x0000010
|
||||
#define D3DTEXOPCAPS_MODULATE4X 0x0000020
|
||||
#define D3DTEXOPCAPS_ADD 0x0000040
|
||||
#define D3DTEXOPCAPS_ADDSIGNED 0x0000080
|
||||
#define D3DTEXOPCAPS_ADDSIGNED2X 0x0000100
|
||||
#define D3DTEXOPCAPS_SUBTRACT 0x0000200
|
||||
#define D3DTEXOPCAPS_ADDSMOOTH 0x0000400
|
||||
#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x0000800
|
||||
#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x0001000
|
||||
#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x0002000
|
||||
#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x0004000
|
||||
#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x0008000
|
||||
#define D3DTEXOPCAPS_PREMODULATE 0x0010000
|
||||
#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x0020000
|
||||
#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x0040000
|
||||
#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x0080000
|
||||
#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x0100000
|
||||
#define D3DTEXOPCAPS_BUMPENVMAP 0x0200000
|
||||
#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x0400000
|
||||
#define D3DTEXOPCAPS_DOTPRODUCT3 0x0800000
|
||||
#define D3DTEXOPCAPS_MULTIPLYADD 0x1000000
|
||||
#define D3DTEXOPCAPS_LERP 0x2000000
|
||||
|
||||
#define D3DVTXPCAPS_TEXGEN 0x01
|
||||
#define D3DVTXPCAPS_MATERIALSOURCE7 0x02
|
||||
#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x08
|
||||
#define D3DVTXPCAPS_POSITIONALLIGHTS 0x10
|
||||
#define D3DVTXPCAPS_LOCALVIEWER 0x20
|
||||
#define D3DVTXPCAPS_TWEENING 0x40
|
||||
|
||||
#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020
|
||||
#define D3DCAPS3_RESERVED 0x8000001f
|
||||
|
||||
#define D3DCAPS2_CANCALIBRATEGAMMA 0x0100000
|
||||
#define D3DCAPS2_CANRENDERWINDOWED 0x0080000
|
||||
#define D3DCAPS2_CANMANAGERESOURCE 0x10000000
|
||||
#define D3DCAPS2_DYNAMICTEXTURES 0x20000000
|
||||
#define D3DCAPS2_FULLSCREENGAMMA 0x0020000
|
||||
#define D3DCAPS2_NO2DDURING3DSCENE 0x0000002
|
||||
#define D3DCAPS2_RESERVED 0x2000000
|
||||
|
||||
/*
|
||||
* The d3dcaps8 structure
|
||||
*/
|
||||
typedef struct _D3DCAPS8 {
|
||||
D3DDEVTYPE DeviceType;
|
||||
UINT AdapterOrdinal;
|
||||
|
||||
DWORD Caps;
|
||||
DWORD Caps2;
|
||||
DWORD Caps3;
|
||||
DWORD PresentationIntervals;
|
||||
|
||||
DWORD CursorCaps;
|
||||
|
||||
DWORD DevCaps;
|
||||
|
||||
DWORD PrimitiveMiscCaps;
|
||||
DWORD RasterCaps;
|
||||
DWORD ZCmpCaps;
|
||||
DWORD SrcBlendCaps;
|
||||
DWORD DestBlendCaps;
|
||||
DWORD AlphaCmpCaps;
|
||||
DWORD ShadeCaps;
|
||||
DWORD TextureCaps;
|
||||
DWORD TextureFilterCaps;
|
||||
DWORD CubeTextureFilterCaps;
|
||||
DWORD VolumeTextureFilterCaps;
|
||||
DWORD TextureAddressCaps;
|
||||
DWORD VolumeTextureAddressCaps;
|
||||
|
||||
DWORD LineCaps;
|
||||
|
||||
DWORD MaxTextureWidth, MaxTextureHeight;
|
||||
DWORD MaxVolumeExtent;
|
||||
|
||||
DWORD MaxTextureRepeat;
|
||||
DWORD MaxTextureAspectRatio;
|
||||
DWORD MaxAnisotropy;
|
||||
float MaxVertexW;
|
||||
|
||||
float GuardBandLeft;
|
||||
float GuardBandTop;
|
||||
float GuardBandRight;
|
||||
float GuardBandBottom;
|
||||
|
||||
float ExtentsAdjust;
|
||||
DWORD StencilCaps;
|
||||
|
||||
DWORD FVFCaps;
|
||||
DWORD TextureOpCaps;
|
||||
DWORD MaxTextureBlendStages;
|
||||
DWORD MaxSimultaneousTextures;
|
||||
|
||||
DWORD VertexProcessingCaps;
|
||||
DWORD MaxActiveLights;
|
||||
DWORD MaxUserClipPlanes;
|
||||
DWORD MaxVertexBlendMatrices;
|
||||
DWORD MaxVertexBlendMatrixIndex;
|
||||
|
||||
float MaxPointSize;
|
||||
|
||||
DWORD MaxPrimitiveCount;
|
||||
DWORD MaxVertexIndex;
|
||||
DWORD MaxStreams;
|
||||
DWORD MaxStreamStride;
|
||||
|
||||
DWORD VertexShaderVersion;
|
||||
DWORD MaxVertexShaderConst;
|
||||
|
||||
DWORD PixelShaderVersion;
|
||||
float MaxPixelShaderValue;
|
||||
} D3DCAPS8;
|
||||
|
||||
#endif /* __WINE_D3D8CAPS_H */
|
1210
reactos/include/d3d8types.h
Normal file
1210
reactos/include/d3d8types.h
Normal file
File diff suppressed because it is too large
Load Diff
1486
reactos/include/d3d9.h
Normal file
1486
reactos/include/d3d9.h
Normal file
File diff suppressed because it is too large
Load Diff
391
reactos/include/d3d9caps.h
Normal file
391
reactos/include/d3d9caps.h
Normal file
@@ -0,0 +1,391 @@
|
||||
/*
|
||||
* Copyright (C) 2002-2003 Jason Edmeades
|
||||
* Raphael Junqueira
|
||||
*
|
||||
* 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_D3D9CAPS_H
|
||||
#define __WINE_D3D9CAPS_H
|
||||
|
||||
/*
|
||||
* Definitions
|
||||
*/
|
||||
#define D3DCAPS_READ_SCANLINE 0x20000
|
||||
|
||||
#define D3DCURSORCAPS_COLOR 1
|
||||
#define D3DCURSORCAPS_LOWRES 2
|
||||
|
||||
|
||||
#define D3DDEVCAPS2_STREAMOFFSET 0x00000001L
|
||||
#define D3DDEVCAPS2_DMAPNPATCH 0x00000002L
|
||||
#define D3DDEVCAPS2_ADAPTIVETESSRTPATCH 0x00000004L
|
||||
#define D3DDEVCAPS2_ADAPTIVETESSNPATCH 0x00000008L
|
||||
#define D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES 0x00000010L
|
||||
#define D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH 0x00000020L
|
||||
#define D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET 0x00000040L
|
||||
|
||||
#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x0000010
|
||||
#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x0000020
|
||||
#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x0000040
|
||||
#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x0000080
|
||||
#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x0000100
|
||||
#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x0000200
|
||||
#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x0000400
|
||||
#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x0000800
|
||||
#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x0001000
|
||||
#define D3DDEVCAPS_DRAWPRIMITIVES2 0x0002000
|
||||
#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x0004000
|
||||
#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x0008000
|
||||
#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x0010000
|
||||
#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x0020000
|
||||
#define D3DDEVCAPS_HWRASTERIZATION 0x0080000
|
||||
#define D3DDEVCAPS_PUREDEVICE 0x0100000
|
||||
#define D3DDEVCAPS_QUINTICRTPATCHES 0x0200000
|
||||
#define D3DDEVCAPS_RTPATCHES 0x0400000
|
||||
#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x0800000
|
||||
#define D3DDEVCAPS_NPATCHES 0x1000000
|
||||
|
||||
#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x00FFFF
|
||||
#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x080000
|
||||
#define D3DFVFCAPS_PSIZE 0x100000
|
||||
|
||||
#define D3DLINECAPS_TEXTURE 0x01
|
||||
#define D3DLINECAPS_ZTEST 0x02
|
||||
#define D3DLINECAPS_BLEND 0x04
|
||||
#define D3DLINECAPS_ALPHACMP 0x08
|
||||
#define D3DLINECAPS_FOG 0x10
|
||||
|
||||
#define D3DPBLENDCAPS_ZERO 0x00000001
|
||||
#define D3DPBLENDCAPS_ONE 0x00000002
|
||||
#define D3DPBLENDCAPS_SRCCOLOR 0x00000004
|
||||
#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008
|
||||
#define D3DPBLENDCAPS_SRCALPHA 0x00000010
|
||||
#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020
|
||||
#define D3DPBLENDCAPS_DESTALPHA 0x00000040
|
||||
#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080
|
||||
#define D3DPBLENDCAPS_DESTCOLOR 0x00000100
|
||||
#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200
|
||||
#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400
|
||||
#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800
|
||||
#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000
|
||||
#define D3DPBLENDCAPS_BLENDFACTOR 0x00002000
|
||||
|
||||
#define D3DPCMPCAPS_NEVER 0x01
|
||||
#define D3DPCMPCAPS_LESS 0x02
|
||||
#define D3DPCMPCAPS_EQUAL 0x04
|
||||
#define D3DPCMPCAPS_LESSEQUAL 0x08
|
||||
#define D3DPCMPCAPS_GREATER 0x10
|
||||
#define D3DPCMPCAPS_NOTEQUAL 0x20
|
||||
#define D3DPCMPCAPS_GREATEREQUAL 0x40
|
||||
#define D3DPCMPCAPS_ALWAYS 0x80
|
||||
|
||||
#define D3DPMISCCAPS_MASKZ 0x00000002L
|
||||
#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L
|
||||
#define D3DPMISCCAPS_CULLNONE 0x00000010L
|
||||
#define D3DPMISCCAPS_CULLCW 0x00000020L
|
||||
#define D3DPMISCCAPS_CULLCCW 0x00000040L
|
||||
#define D3DPMISCCAPS_COLORWRITEENABLE 0x00000080L
|
||||
#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100L
|
||||
#define D3DPMISCCAPS_CLIPTLVERTS 0x00000200L
|
||||
#define D3DPMISCCAPS_TSSARGTEMP 0x00000400L
|
||||
#define D3DPMISCCAPS_BLENDOP 0x00000800L
|
||||
#define D3DPMISCCAPS_NULLREFERENCE 0x00001000L
|
||||
#define D3DPMISCCAPS_INDEPENDENTWRITEMASKS 0x00004000L
|
||||
#define D3DPMISCCAPS_PERSTAGECONSTANT 0x00008000L
|
||||
#define D3DPMISCCAPS_FOGANDSPECULARALPHA 0x00010000L
|
||||
#define D3DPMISCCAPS_SEPARATEALPHABLEND 0x00020000L
|
||||
#define D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS 0x00040000L
|
||||
#define D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING 0x00080000L
|
||||
#define D3DPMISCCAPS_FOGVERTEXCLAMPED 0x00100000L
|
||||
|
||||
|
||||
#define D3DPRASTERCAPS_DITHER 0x00000001L
|
||||
#define D3DPRASTERCAPS_PAT 0x00000008L
|
||||
#define D3DPRASTERCAPS_ZTEST 0x00000010L
|
||||
#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L
|
||||
#define D3DPRASTERCAPS_FOGTABLE 0x00000100L
|
||||
#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000L
|
||||
#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L
|
||||
#define D3DPRASTERCAPS_ZBIAS 0x00004000L
|
||||
#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L
|
||||
#define D3DPRASTERCAPS_FOGRANGE 0x00010000L
|
||||
#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L
|
||||
#define D3DPRASTERCAPS_WBUFFER 0x00040000L
|
||||
#define D3DPRASTERCAPS_WFOG 0x00100000L
|
||||
#define D3DPRASTERCAPS_ZFOG 0x00200000L
|
||||
#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000L
|
||||
#define D3DPRASTERCAPS_SCISSORTEST 0x01000000L
|
||||
#define D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS 0x02000000L
|
||||
#define D3DPRASTERCAPS_DEPTHBIAS 0x04000000L
|
||||
#define D3DPRASTERCAPS_MULTISAMPLE_TOGGLE 0x08000000L
|
||||
|
||||
#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000
|
||||
#define D3DPRESENT_INTERVAL_ONE 0x00000001
|
||||
#define D3DPRESENT_INTERVAL_TWO 0x00000002
|
||||
#define D3DPRESENT_INTERVAL_THREE 0x00000004
|
||||
#define D3DPRESENT_INTERVAL_FOUR 0x00000008
|
||||
#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000
|
||||
|
||||
#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00008
|
||||
#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00200
|
||||
#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x04000
|
||||
#define D3DPSHADECAPS_FOGGOURAUD 0x80000
|
||||
|
||||
#define D3DPTADDRESSCAPS_WRAP 0x01
|
||||
#define D3DPTADDRESSCAPS_MIRROR 0x02
|
||||
#define D3DPTADDRESSCAPS_CLAMP 0x04
|
||||
#define D3DPTADDRESSCAPS_BORDER 0x08
|
||||
#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x10
|
||||
#define D3DPTADDRESSCAPS_MIRRORONCE 0x20
|
||||
|
||||
#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L
|
||||
#define D3DPTEXTURECAPS_POW2 0x00000002L
|
||||
#define D3DPTEXTURECAPS_ALPHA 0x00000004L
|
||||
#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L
|
||||
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L
|
||||
#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L
|
||||
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L
|
||||
#define D3DPTEXTURECAPS_PROJECTED 0x00000400L
|
||||
#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L
|
||||
#define D3DPTEXTURECAPS_VOLUMEMAP 0x00002000L
|
||||
#define D3DPTEXTURECAPS_MIPMAP 0x00004000L
|
||||
#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000L
|
||||
#define D3DPTEXTURECAPS_MIPCUBEMAP 0x00010000L
|
||||
#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000L
|
||||
#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000L
|
||||
#define D3DPTEXTURECAPS_NOPROJECTEDBUMPENV 0x00200000L
|
||||
|
||||
#define D3DPTFILTERCAPS_MINFPOINT 0x00000100
|
||||
#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200
|
||||
#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400
|
||||
#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000
|
||||
#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000
|
||||
#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000
|
||||
#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000
|
||||
#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000
|
||||
#define D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD 0x08000000
|
||||
#define D3DPTFILTERCAPS_MAGFGAUSSIANQUAD 0x10000000
|
||||
|
||||
#define D3DSTENCILCAPS_KEEP 0x01
|
||||
#define D3DSTENCILCAPS_ZERO 0x02
|
||||
#define D3DSTENCILCAPS_REPLACE 0x04
|
||||
#define D3DSTENCILCAPS_INCRSAT 0x08
|
||||
#define D3DSTENCILCAPS_DECRSAT 0x10
|
||||
#define D3DSTENCILCAPS_INVERT 0x20
|
||||
#define D3DSTENCILCAPS_INCR 0x40
|
||||
#define D3DSTENCILCAPS_DECR 0x80
|
||||
|
||||
#define D3DTEXOPCAPS_DISABLE 0x0000001
|
||||
#define D3DTEXOPCAPS_SELECTARG1 0x0000002
|
||||
#define D3DTEXOPCAPS_SELECTARG2 0x0000004
|
||||
#define D3DTEXOPCAPS_MODULATE 0x0000008
|
||||
#define D3DTEXOPCAPS_MODULATE2X 0x0000010
|
||||
#define D3DTEXOPCAPS_MODULATE4X 0x0000020
|
||||
#define D3DTEXOPCAPS_ADD 0x0000040
|
||||
#define D3DTEXOPCAPS_ADDSIGNED 0x0000080
|
||||
#define D3DTEXOPCAPS_ADDSIGNED2X 0x0000100
|
||||
#define D3DTEXOPCAPS_SUBTRACT 0x0000200
|
||||
#define D3DTEXOPCAPS_ADDSMOOTH 0x0000400
|
||||
#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x0000800
|
||||
#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x0001000
|
||||
#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x0002000
|
||||
#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x0004000
|
||||
#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x0008000
|
||||
#define D3DTEXOPCAPS_PREMODULATE 0x0010000
|
||||
#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x0020000
|
||||
#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x0040000
|
||||
#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x0080000
|
||||
#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x0100000
|
||||
#define D3DTEXOPCAPS_BUMPENVMAP 0x0200000
|
||||
#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x0400000
|
||||
#define D3DTEXOPCAPS_DOTPRODUCT3 0x0800000
|
||||
#define D3DTEXOPCAPS_MULTIPLYADD 0x1000000
|
||||
#define D3DTEXOPCAPS_LERP 0x2000000
|
||||
|
||||
#define D3DVTXPCAPS_TEXGEN 0x00000001L
|
||||
#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L
|
||||
#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L
|
||||
#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L
|
||||
#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L
|
||||
#define D3DVTXPCAPS_TWEENING 0x00000040L
|
||||
#define D3DVTXPCAPS_TEXGEN_SPHEREMAP 0x00000100L
|
||||
#define D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER 0x00000200L
|
||||
|
||||
#define D3DDTCAPS_UBYTE4 0x00000001L
|
||||
#define D3DDTCAPS_UBYTE4N 0x00000002L
|
||||
#define D3DDTCAPS_SHORT2N 0x00000004L
|
||||
#define D3DDTCAPS_SHORT4N 0x00000008L
|
||||
#define D3DDTCAPS_USHORT2N 0x00000010L
|
||||
#define D3DDTCAPS_USHORT4N 0x00000020L
|
||||
#define D3DDTCAPS_UDEC3 0x00000040L
|
||||
#define D3DDTCAPS_DEC3N 0x00000080L
|
||||
#define D3DDTCAPS_FLOAT16_2 0x00000100L
|
||||
#define D3DDTCAPS_FLOAT16_4 0x00000200L
|
||||
|
||||
#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020L
|
||||
#define D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION 0x00000080L
|
||||
#define D3DCAPS3_COPY_TO_VIDMEM 0x00000100L
|
||||
#define D3DCAPS3_COPY_TO_SYSTEMMEM 0x00000200L
|
||||
#define D3DCAPS3_RESERVED 0x8000001FL
|
||||
|
||||
#define D3DCAPS2_NO2DDURING3DSCENE 0x00000002L
|
||||
#define D3DCAPS2_FULLSCREENGAMMA 0x00020000L
|
||||
#define D3DCAPS2_CANRENDERWINDOWED 0x00080000L
|
||||
#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000L
|
||||
#define D3DCAPS2_RESERVED 0x02000000L
|
||||
#define D3DCAPS2_CANMANAGERESOURCE 0x10000000L
|
||||
#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L
|
||||
#define D3DCAPS2_CANAUTOGENMIPMAP 0x40000000L
|
||||
|
||||
|
||||
#define D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH 24
|
||||
#define D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH 0
|
||||
#define D3DVS20_MAX_NUMTEMPS 32
|
||||
#define D3DVS20_MIN_NUMTEMPS 12
|
||||
#define D3DVS20_MAX_STATICFLOWCONTROLDEPTH 4
|
||||
#define D3DVS20_MIN_STATICFLOWCONTROLDEPTH 1
|
||||
|
||||
#define D3DVS20CAPS_PREDICATION (1 << 0)
|
||||
|
||||
#define D3DPS20CAPS_ARBITRARYSWIZZLE (1 << 0)
|
||||
#define D3DPS20CAPS_GRADIENTINSTRUCTIONS (1 << 1)
|
||||
#define D3DPS20CAPS_PREDICATION (1 << 2)
|
||||
#define D3DPS20CAPS_NODEPENDENTREADLIMIT (1 << 3)
|
||||
#define D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT (1 << 4)
|
||||
|
||||
#define D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH 24
|
||||
#define D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH 0
|
||||
#define D3DPS20_MAX_NUMTEMPS 32
|
||||
#define D3DPS20_MIN_NUMTEMPS 12
|
||||
#define D3DPS20_MAX_STATICFLOWCONTROLDEPTH 4
|
||||
#define D3DPS20_MIN_STATICFLOWCONTROLDEPTH 0
|
||||
#define D3DPS20_MAX_NUMINSTRUCTIONSLOTS 512
|
||||
#define D3DPS20_MIN_NUMINSTRUCTIONSLOTS 96
|
||||
|
||||
#define D3DMIN30SHADERINSTRUCTIONS 512
|
||||
#define D3DMAX30SHADERINSTRUCTIONS 32768
|
||||
|
||||
|
||||
typedef struct _D3DVSHADERCAPS2_0 {
|
||||
DWORD Caps;
|
||||
INT DynamicFlowControlDepth;
|
||||
INT NumTemps;
|
||||
INT StaticFlowControlDepth;
|
||||
} D3DVSHADERCAPS2_0;
|
||||
|
||||
typedef struct _D3DPSHADERCAPS2_0 {
|
||||
DWORD Caps;
|
||||
INT DynamicFlowControlDepth;
|
||||
INT NumTemps;
|
||||
INT StaticFlowControlDepth;
|
||||
INT NumInstructionSlots;
|
||||
} D3DPSHADERCAPS2_0;
|
||||
|
||||
/*
|
||||
* The d3dcaps9 structure
|
||||
*/
|
||||
typedef struct _D3DCAPS9 {
|
||||
D3DDEVTYPE DeviceType;
|
||||
UINT AdapterOrdinal;
|
||||
|
||||
DWORD Caps;
|
||||
DWORD Caps2;
|
||||
DWORD Caps3;
|
||||
DWORD PresentationIntervals;
|
||||
|
||||
DWORD CursorCaps;
|
||||
|
||||
DWORD DevCaps;
|
||||
|
||||
DWORD PrimitiveMiscCaps;
|
||||
DWORD RasterCaps;
|
||||
DWORD ZCmpCaps;
|
||||
DWORD SrcBlendCaps;
|
||||
DWORD DestBlendCaps;
|
||||
DWORD AlphaCmpCaps;
|
||||
DWORD ShadeCaps;
|
||||
DWORD TextureCaps;
|
||||
DWORD TextureFilterCaps;
|
||||
DWORD CubeTextureFilterCaps;
|
||||
DWORD VolumeTextureFilterCaps;
|
||||
DWORD TextureAddressCaps;
|
||||
DWORD VolumeTextureAddressCaps;
|
||||
|
||||
DWORD LineCaps;
|
||||
|
||||
DWORD MaxTextureWidth, MaxTextureHeight;
|
||||
DWORD MaxVolumeExtent;
|
||||
|
||||
DWORD MaxTextureRepeat;
|
||||
DWORD MaxTextureAspectRatio;
|
||||
DWORD MaxAnisotropy;
|
||||
float MaxVertexW;
|
||||
|
||||
float GuardBandLeft;
|
||||
float GuardBandTop;
|
||||
float GuardBandRight;
|
||||
float GuardBandBottom;
|
||||
|
||||
float ExtentsAdjust;
|
||||
DWORD StencilCaps;
|
||||
|
||||
DWORD FVFCaps;
|
||||
DWORD TextureOpCaps;
|
||||
DWORD MaxTextureBlendStages;
|
||||
DWORD MaxSimultaneousTextures;
|
||||
|
||||
DWORD VertexProcessingCaps;
|
||||
DWORD MaxActiveLights;
|
||||
DWORD MaxUserClipPlanes;
|
||||
DWORD MaxVertexBlendMatrices;
|
||||
DWORD MaxVertexBlendMatrixIndex;
|
||||
|
||||
float MaxPointSize;
|
||||
|
||||
DWORD MaxPrimitiveCount;
|
||||
DWORD MaxVertexIndex;
|
||||
DWORD MaxStreams;
|
||||
DWORD MaxStreamStride;
|
||||
|
||||
DWORD VertexShaderVersion;
|
||||
DWORD MaxVertexShaderConst;
|
||||
|
||||
DWORD PixelShaderVersion;
|
||||
float MaxPixelShaderValue;
|
||||
|
||||
/* DX 9 */
|
||||
DWORD DevCaps2;
|
||||
|
||||
float MaxNpatchTessellationLevel;
|
||||
DWORD Reserved5;
|
||||
|
||||
UINT MasterAdapterOrdinal;
|
||||
UINT AdapterOrdinalInGroup;
|
||||
UINT NumberOfAdaptersInGroup;
|
||||
DWORD DeclTypes;
|
||||
DWORD NumSimultaneousRTs;
|
||||
DWORD StretchRectFilterCaps;
|
||||
D3DVSHADERCAPS2_0 VS20Caps;
|
||||
D3DPSHADERCAPS2_0 PS20Caps;
|
||||
DWORD VertexTextureFilterCaps;
|
||||
DWORD MaxVShaderInstructionsExecuted;
|
||||
DWORD MaxPShaderInstructionsExecuted;
|
||||
DWORD MaxVertexShader30InstructionSlots;
|
||||
DWORD MaxPixelShader30InstructionSlots;
|
||||
|
||||
} D3DCAPS9;
|
||||
|
||||
#endif
|
1518
reactos/include/d3d9types.h
Normal file
1518
reactos/include/d3d9types.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003 Martin Fuchs
|
||||
* Copyright (C) 2005 Peter Berg Larsen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -16,29 +16,10 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __D3DRM_H__
|
||||
#define __D3DRM_H__
|
||||
|
||||
//
|
||||
// Explorer and Desktop clone
|
||||
//
|
||||
// shellhook.h
|
||||
//
|
||||
// Martin Fuchs, 17.08.2003
|
||||
//
|
||||
#include <ddraw.h>
|
||||
/* #include <d3drmobj.h> */
|
||||
|
||||
|
||||
#ifdef _SHELLHOOK_IMPL
|
||||
#define DECL_SHELLHOOK __declspec(dllexport)
|
||||
#else
|
||||
#define DECL_SHELLHOOK __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DECL_SHELLHOOK void InstallShellHook(HWND callback_hwnd, UINT callback_msg);
|
||||
DECL_SHELLHOOK void DeinstallShellHook();
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
#endif /* __D3DRM_H__ */
|
@@ -25,12 +25,13 @@
|
||||
#ifndef __WINE_D3DTYPES_H
|
||||
#define __WINE_D3DTYPES_H
|
||||
|
||||
/* #include <windows.h> FIXME: Need to include for compatibility. Inclusion caused compile fail */
|
||||
|
||||
#include <float.h>
|
||||
#include <ddraw.h>
|
||||
|
||||
#define D3DVALP(val, prec) ((float)(val))
|
||||
#define D3DVAL(val) ((float)(val))
|
||||
typedef float D3DVALUE,*LPD3DVALUE;
|
||||
#define D3DDivide(a, b) (float)((double) (a) / (double) (b))
|
||||
#define D3DMultiply(a, b) ((a) * (b))
|
||||
|
||||
@@ -75,53 +76,16 @@ typedef HRESULT (CALLBACK *LPD3DVALIDATECALLBACK)(LPVOID lpUserArg, DWORD dwOffs
|
||||
typedef HRESULT (CALLBACK *LPD3DENUMTEXTUREFORMATSCALLBACK)(LPDDSURFACEDESC lpDdsd, LPVOID lpContext);
|
||||
typedef HRESULT (CALLBACK *LPD3DENUMPIXELFORMATSCALLBACK)(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext);
|
||||
|
||||
#ifndef DX_SHARED_DEFINES
|
||||
|
||||
typedef float D3DVALUE,*LPD3DVALUE;
|
||||
|
||||
#ifndef D3DCOLOR_DEFINED
|
||||
typedef DWORD D3DCOLOR, *LPD3DCOLOR;
|
||||
#define D3DCOLOR_DEFINED
|
||||
#endif
|
||||
|
||||
typedef DWORD D3DMATERIALHANDLE, *LPD3DMATERIALHANDLE;
|
||||
typedef DWORD D3DTEXTUREHANDLE, *LPD3DTEXTUREHANDLE;
|
||||
typedef DWORD D3DMATRIXHANDLE, *LPD3DMATRIXHANDLE;
|
||||
|
||||
typedef struct _D3DCOLORVALUE {
|
||||
union {
|
||||
D3DVALUE r;
|
||||
D3DVALUE dvR;
|
||||
} DUMMYUNIONNAME1;
|
||||
union {
|
||||
D3DVALUE g;
|
||||
D3DVALUE dvG;
|
||||
} DUMMYUNIONNAME2;
|
||||
union {
|
||||
D3DVALUE b;
|
||||
D3DVALUE dvB;
|
||||
} DUMMYUNIONNAME3;
|
||||
union {
|
||||
D3DVALUE a;
|
||||
D3DVALUE dvA;
|
||||
} DUMMYUNIONNAME4;
|
||||
} D3DCOLORVALUE,*LPD3DCOLORVALUE;
|
||||
|
||||
typedef struct _D3DRECT {
|
||||
union {
|
||||
LONG x1;
|
||||
LONG lX1;
|
||||
} DUMMYUNIONNAME1;
|
||||
union {
|
||||
LONG y1;
|
||||
LONG lY1;
|
||||
} DUMMYUNIONNAME2;
|
||||
union {
|
||||
LONG x2;
|
||||
LONG lX2;
|
||||
} DUMMYUNIONNAME3;
|
||||
union {
|
||||
LONG y2;
|
||||
LONG lY2;
|
||||
} DUMMYUNIONNAME4;
|
||||
} D3DRECT, *LPD3DRECT;
|
||||
|
||||
#ifndef D3DVECTOR_DEFINED
|
||||
typedef struct _D3DVECTOR {
|
||||
union {
|
||||
D3DVALUE x;
|
||||
@@ -173,6 +137,53 @@ public:
|
||||
friend _D3DVECTOR CrossProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2);
|
||||
#endif
|
||||
} D3DVECTOR,*LPD3DVECTOR;
|
||||
#define D3DVECTOR_DEFINED
|
||||
#endif
|
||||
|
||||
#define DX_SHARED_DEFINES
|
||||
#endif /* DX_SHARED_DEFINES */
|
||||
|
||||
typedef DWORD D3DMATERIALHANDLE, *LPD3DMATERIALHANDLE;
|
||||
typedef DWORD D3DTEXTUREHANDLE, *LPD3DTEXTUREHANDLE;
|
||||
typedef DWORD D3DMATRIXHANDLE, *LPD3DMATRIXHANDLE;
|
||||
|
||||
typedef struct _D3DCOLORVALUE {
|
||||
union {
|
||||
D3DVALUE r;
|
||||
D3DVALUE dvR;
|
||||
} DUMMYUNIONNAME1;
|
||||
union {
|
||||
D3DVALUE g;
|
||||
D3DVALUE dvG;
|
||||
} DUMMYUNIONNAME2;
|
||||
union {
|
||||
D3DVALUE b;
|
||||
D3DVALUE dvB;
|
||||
} DUMMYUNIONNAME3;
|
||||
union {
|
||||
D3DVALUE a;
|
||||
D3DVALUE dvA;
|
||||
} DUMMYUNIONNAME4;
|
||||
} D3DCOLORVALUE,*LPD3DCOLORVALUE;
|
||||
|
||||
typedef struct _D3DRECT {
|
||||
union {
|
||||
LONG x1;
|
||||
LONG lX1;
|
||||
} DUMMYUNIONNAME1;
|
||||
union {
|
||||
LONG y1;
|
||||
LONG lY1;
|
||||
} DUMMYUNIONNAME2;
|
||||
union {
|
||||
LONG x2;
|
||||
LONG lX2;
|
||||
} DUMMYUNIONNAME3;
|
||||
union {
|
||||
LONG y2;
|
||||
LONG lY2;
|
||||
} DUMMYUNIONNAME4;
|
||||
} D3DRECT, *LPD3DRECT;
|
||||
|
||||
typedef struct _D3DHVERTEX {
|
||||
DWORD dwFlags;
|
||||
@@ -330,7 +341,7 @@ typedef struct _D3DMATRIX {
|
||||
} D3DMATRIX, *LPD3DMATRIX;
|
||||
|
||||
#if defined(__cplusplus) && defined(D3D_OVERLOADS)
|
||||
#include "d3dvec.inl"
|
||||
#include <d3dvec.inl>
|
||||
#endif
|
||||
|
||||
typedef struct _D3DVIEWPORT {
|
||||
|
141
reactos/include/d3dvec.inl
Normal file
141
reactos/include/d3dvec.inl
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (C) 2000 Ove Kaaven
|
||||
*
|
||||
* 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_D3DVEC_INL
|
||||
#define __WINE_D3DVEC_INL
|
||||
|
||||
/*** constructors ***/
|
||||
|
||||
inline _D3DVECTOR::_D3DVECTOR(D3DVALUE f)
|
||||
{
|
||||
x = y = z = f;
|
||||
}
|
||||
|
||||
inline _D3DVECTOR::_D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z)
|
||||
{
|
||||
x = _x; y = _y; z = _z;
|
||||
}
|
||||
|
||||
/*** assignment operators ***/
|
||||
|
||||
inline _D3DVECTOR& _D3DVECTOR::operator += (const _D3DVECTOR& v)
|
||||
{
|
||||
x += v.x; y += v.y; z += v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline _D3DVECTOR& _D3DVECTOR::operator -= (const _D3DVECTOR& v)
|
||||
{
|
||||
x -= v.x; y -= v.y; z -= v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline _D3DVECTOR& _D3DVECTOR::operator *= (const _D3DVECTOR& v)
|
||||
{
|
||||
x *= v.x; y *= v.y; z *= v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline _D3DVECTOR& _D3DVECTOR::operator /= (const _D3DVECTOR& v)
|
||||
{
|
||||
x /= v.x; y /= v.y; z /= v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline _D3DVECTOR& _D3DVECTOR::operator *= (D3DVALUE s)
|
||||
{
|
||||
x *= s; y *= s; z *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline _D3DVECTOR& _D3DVECTOR::operator /= (D3DVALUE s)
|
||||
{
|
||||
x /= s; y /= s; z /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*** unary operators ***/
|
||||
|
||||
inline _D3DVECTOR operator + (const _D3DVECTOR& v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
inline _D3DVECTOR operator - (const _D3DVECTOR& v)
|
||||
{
|
||||
return _D3DVECTOR(-v.x, -v.y, -v.z);
|
||||
}
|
||||
|
||||
/*** binary operators ***/
|
||||
|
||||
inline _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
|
||||
{
|
||||
return _D3DVECTOR(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
|
||||
}
|
||||
|
||||
inline _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
|
||||
{
|
||||
return _D3DVECTOR(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
|
||||
}
|
||||
|
||||
inline _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s)
|
||||
{
|
||||
return _D3DVECTOR(v.x*s, v.y*s, v.z*s);
|
||||
}
|
||||
|
||||
inline _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v)
|
||||
{
|
||||
return _D3DVECTOR(v.x*s, v.y*s, v.z*s);
|
||||
}
|
||||
|
||||
inline _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s)
|
||||
{
|
||||
return _D3DVECTOR(v.x/s, v.y/s, v.z/s);
|
||||
}
|
||||
|
||||
inline D3DVALUE SquareMagnitude(const _D3DVECTOR& v)
|
||||
{
|
||||
return v.x*v.x + v.y*v.y + v.z*v.z; /* DotProduct(v, v) */
|
||||
}
|
||||
|
||||
inline D3DVALUE Magnitude(const _D3DVECTOR& v)
|
||||
{
|
||||
return sqrt(SquareMagnitude(v));
|
||||
}
|
||||
|
||||
inline _D3DVECTOR Normalize(const _D3DVECTOR& v)
|
||||
{
|
||||
return v / Magnitude(v);
|
||||
}
|
||||
|
||||
inline D3DVALUE DotProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2)
|
||||
{
|
||||
return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
|
||||
}
|
||||
|
||||
inline _D3DVECTOR CrossProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2)
|
||||
{
|
||||
_D3DVECTOR res;
|
||||
/* this is a left-handed cross product, right? */
|
||||
res.x = v1.y * v2.z - v1.z * v2.y;
|
||||
res.y = v1.z * v2.x - v1.x * v2.z;
|
||||
res.z = v1.x * v2.y - v1.y * v2.x;
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
128
reactos/include/d3dx8core.h
Normal file
128
reactos/include/d3dx8core.h
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (C) 2002 Raphael Junqueira
|
||||
*
|
||||
* 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_D3DX8CORE_H
|
||||
#define __WINE_D3DX8CORE_H
|
||||
|
||||
#include <objbase.h>
|
||||
|
||||
#include <d3d8.h>
|
||||
#include <d3d8types.h>
|
||||
#include <d3d8caps.h>
|
||||
|
||||
/*****************************************************************************
|
||||
* #defines and error codes
|
||||
*/
|
||||
#define D3DXASM_DEBUG 1
|
||||
#define D3DXASM_SKIPVALIDATION 2
|
||||
|
||||
#define _FACD3D 0x876
|
||||
#define MAKE_D3DXHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code )
|
||||
|
||||
/*
|
||||
* Direct3D Errors
|
||||
*/
|
||||
#define D3DXERR_CANNOTATTRSORT MAKE_D3DXHRESULT(2158)
|
||||
#define D3DXERR_CANNOTMODIFYINDEXBUFFER MAKE_D3DXHRESULT(2159)
|
||||
#define D3DXERR_INVALIDMESH MAKE_D3DXHRESULT(2160)
|
||||
#define D3DXERR_SKINNINGNOTSUPPORTED MAKE_D3DXHRESULT(2161)
|
||||
#define D3DXERR_TOOMANYINFLUENCES MAKE_D3DXHRESULT(2162)
|
||||
#define D3DXERR_INVALIDDATA MAKE_D3DXHRESULT(2163)
|
||||
|
||||
/*****************************************************************************
|
||||
* Predeclare the interfaces
|
||||
*/
|
||||
DEFINE_GUID(IID_ID3DXBuffer, 0x1,0x1,0x4,0xB0,0xCF,0x98,0xFE,0xFD,0xFF,0x95,0x12);/* FIXME */
|
||||
typedef struct ID3DXBuffer ID3DXBuffer, *LPD3DXBUFFER;
|
||||
DEFINE_GUID(IID_ID3DXFont, 0x1,0x1,0x4,0xB0,0xCF,0x98,0xFE,0xFD,0xFF,0x95,0x13);/* FIXME */
|
||||
typedef struct ID3DXFont ID3DXFont, *LPD3DXFONT;
|
||||
|
||||
/*****************************************************************************
|
||||
* ID3DXBuffer interface
|
||||
*/
|
||||
#define INTERFACE ID3DXBuffer
|
||||
DECLARE_INTERFACE_(ID3DXBuffer,IUnknown)
|
||||
{
|
||||
/*** IUnknown methods ***/
|
||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** ID3DXBuffer methods ***/
|
||||
STDMETHOD_(LPVOID,GetBufferPointer)(THIS) PURE;
|
||||
STDMETHOD_(DWORD,GetBufferSize)(THIS) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
#if !defined(__cplusplus) || defined(CINTERFACE)
|
||||
/*** IUnknown methods ***/
|
||||
#define ID3DXBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||
#define ID3DXBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define ID3DXBuffer_Release(p) (p)->lpVtbl->Release(p)
|
||||
/*** ID3DXBuffer methods ***/
|
||||
#define ID3DXBuffer_GetBufferPointer(p) (p)->lpVtbl->GetBufferPointer(p)
|
||||
#define ID3DXBuffer_GetBufferSize(p) (p)->lpVtbl->GetBufferSize(p)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* ID3DXFont interface
|
||||
*/
|
||||
#define INTERFACE ID3DXFont
|
||||
DECLARE_INTERFACE_(ID3DXFont,IUnknown)
|
||||
{
|
||||
/*** IUnknown methods ***/
|
||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** ID3DXFont methods ***/
|
||||
STDMETHOD(Begin)(THIS) PURE;
|
||||
STDMETHOD(DrawTextA)(THIS) PURE;
|
||||
STDMETHOD(End)(THIS) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
#if !defined(__cplusplus) || defined(CINTERFACE)
|
||||
/*** IUnknown methods ***/
|
||||
#define ID3DXFont_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||
#define ID3DXFont_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define ID3DXFont_Release(p) (p)->lpVtbl->Release(p)
|
||||
/*** ID3DXFont methods ***/
|
||||
#define ID3DXFont_Begin(p) (p)->lpVtbl->Begin(p)
|
||||
#define ID3DXFont_DrawTextA(p,a,b,c,d,e)(p)->lpVtbl->DrawText(p,a,b,c,d,e)
|
||||
#define ID3DXFont_End(p) (p)->lpVtbl->End(p)
|
||||
#endif
|
||||
|
||||
/*************************************************************************************
|
||||
* Define entrypoints
|
||||
*/
|
||||
HRESULT WINAPI D3DXCreateBuffer(DWORD NumBytes, LPD3DXBUFFER* ppBuffer);
|
||||
HRESULT WINAPI D3DXCreateFont(LPDIRECT3DDEVICE8 pDevice, HFONT hFont, LPD3DXFONT* ppFont);
|
||||
UINT WINAPI D3DXGetFVFVertexSize(DWORD FVF);
|
||||
HRESULT WINAPI D3DXAssembleShader(LPCVOID pSrcData, UINT SrcDataLen, DWORD Flags,
|
||||
LPD3DXBUFFER* ppConstants,
|
||||
LPD3DXBUFFER* ppCompiledShader,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
HRESULT WINAPI D3DXAssembleShaderFromFileA(LPSTR pSrcFile, DWORD Flags,
|
||||
LPD3DXBUFFER* ppConstants,
|
||||
LPD3DXBUFFER* ppCompiledShader,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
HRESULT WINAPI D3DXAssembleShaderFromFileW(LPSTR pSrcFile, DWORD Flags,
|
||||
LPD3DXBUFFER* ppConstants,
|
||||
LPD3DXBUFFER* ppCompiledShader,
|
||||
LPD3DXBUFFER* ppCompilationErrors);
|
||||
|
||||
#endif /* __WINE_D3DX8CORE_H */
|
@@ -10,7 +10,10 @@ typedef enum _KEY_INFORMATION_CLASS
|
||||
{
|
||||
KeyBasicInformation,
|
||||
KeyNodeInformation,
|
||||
KeyFullInformation
|
||||
KeyFullInformation,
|
||||
KeyNameInformation,
|
||||
KeyCachedInformation,
|
||||
KeyFlagsInformation
|
||||
} KEY_INFORMATION_CLASS;
|
||||
|
||||
typedef struct _KEY_BASIC_INFORMATION
|
||||
|
@@ -46,7 +46,6 @@ typedef struct _EX_WORK_QUEUE {
|
||||
EX_QUEUE_WORKER_INFO Info;
|
||||
} EX_WORK_QUEUE, *PEX_WORK_QUEUE;
|
||||
|
||||
|
||||
typedef ULONG_PTR ERESOURCE_THREAD, *PERESOURCE_THREAD;
|
||||
|
||||
typedef struct _OWNER_ENTRY
|
||||
@@ -257,10 +256,6 @@ typedef VOID STDCALL_FUNC
|
||||
PVOID Argument1,
|
||||
PVOID Argument2);
|
||||
|
||||
extern struct _OBJECT_TYPE EXPORTED *ExMutantObjectType;
|
||||
extern struct _OBJECT_TYPE EXPORTED *ExSemaphoreObjectType;
|
||||
extern struct _OBJECT_TYPE EXPORTED *ExTimerType;
|
||||
|
||||
#endif /* __INCLUDE_DDK_EXTYPES_H */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -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
|
||||
|
@@ -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,
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -269,6 +269,7 @@ typedef struct _DDNONLOCALVIDMEMCAPS {
|
||||
|
||||
|
||||
|
||||
|
||||
#define DDSCAPS_EXECUTEBUFFER DDSCAPS_RESERVED2
|
||||
#define DDSCAPS2_VERTEXBUFFER DDSCAPS2_RESERVED1
|
||||
#define DDSCAPS2_COMMANDBUFFER DDSCAPS2_RESERVED2
|
||||
|
19
reactos/include/idl/pnp.idl
Normal file
19
reactos/include/idl/pnp.idl
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Plug and Play Manager interface definition
|
||||
*/
|
||||
|
||||
#define WORD unsigned short
|
||||
|
||||
[
|
||||
uuid (809F4e40-A03D-11CE-8F69-08003E30051B),
|
||||
version(1.0),
|
||||
pointer_default(unique),
|
||||
explicit_handle
|
||||
]
|
||||
interface pnp
|
||||
{
|
||||
// unsigned long PNP_GetRootDeviceInstance(handle_t BindingHandle,
|
||||
// [out, string, size_is(Length)] wchar_t *DeviceInstance,
|
||||
// [in] unsigned long Length);
|
||||
WORD PNP_GetVersion(handle_t BindingHandle);
|
||||
}
|
@@ -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
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -490,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
|
||||
|
@@ -590,6 +590,7 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY {
|
||||
#define IMAGE_SUBSYSTEM_OS2_CUI 5
|
||||
#define IMAGE_SUBSYSTEM_POSIX_GUI 6
|
||||
#define IMAGE_SUBSYSTEM_POSIX_CUI 7
|
||||
#define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8
|
||||
#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
|
||||
#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
|
||||
#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
|
||||
|
@@ -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 */
|
||||
|
@@ -37,4 +37,10 @@
|
||||
#define IOCTL_TCP_SET_INFORMATION_EX \
|
||||
_TCP_CTL_CODE(1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
|
||||
#define IOCTL_SET_IP_ADDRESS \
|
||||
_TCP_CTL_CODE(14, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
|
||||
#define IOCTL_DELETE_IP_ADDRESS \
|
||||
_TCP_CTL_CODE(16, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
|
||||
#endif/*_TCPIOCTL_H*/
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user