1
0
mirror of https://github.com/UzixLS/KernelEx.git synced 2025-07-19 07:21:20 +03:00

import KernelEx-4.0-RC1

This commit is contained in:
UzixLS
2018-11-03 16:18:57 +03:00
commit d4e0420295
295 changed files with 28034 additions and 0 deletions

66
auxiliary/auxiliary.dsp Normal file
View File

@ -0,0 +1,66 @@
# Microsoft Developer Studio Project File - Name="auxiliary" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) External Target" 0x0106
CFG=auxiliary - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "auxiliary.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "auxiliary.mak" CFG="auxiliary - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "auxiliary - Win32 Release" (based on "Win32 (x86) External Target")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
# PROP BASE Use_MFC
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Cmd_Line "NMAKE /f auxiliary.mak"
# PROP BASE Rebuild_Opt "/a"
# PROP BASE Target_File "auxiliary.exe"
# PROP BASE Bsc_Name "auxiliary.bsc"
# PROP BASE Target_Dir ""
# PROP Use_MFC
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Cmd_Line "nmake /nologo /f makefile.msv ide"
# PROP Rebuild_Opt "/a"
# PROP Target_File "auxiliary"
# PROP Bsc_Name ""
# PROP Target_Dir ""
# Begin Target
# Name "auxiliary - Win32 Release"
!IF "$(CFG)" == "auxiliary - Win32 Release"
!ENDIF
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

20
auxiliary/makefile Normal file
View File

@ -0,0 +1,20 @@
all :
@$(MAKE) -C msimg32 $@
@$(MAKE) -C pdh $@
@$(MAKE) -C wtsapi32 $@
@$(MAKE) -C uxtheme $@
@$(MAKE) -C psapi $@
clean :
@$(MAKE) -C msimg32 $@
@$(MAKE) -C pdh $@
@$(MAKE) -C wtsapi32 $@
@$(MAKE) -C uxtheme $@
@$(MAKE) -C psapi $@
realclean :
@$(MAKE) -C msimg32 $@
@$(MAKE) -C pdh $@
@$(MAKE) -C wtsapi32 $@
@$(MAKE) -C uxtheme $@
@$(MAKE) -C psapi $@

36
auxiliary/makefile.msv Normal file
View File

@ -0,0 +1,36 @@
all :
cd msimg32
@$(MAKE) /nologo /f makefile.msv $@
cd ..
cd pdh
@$(MAKE) /nologo /f makefile.msv $@
cd ..
cd wtsapi32
@$(MAKE) /nologo /f makefile.msv $@
cd ..
cd uxtheme
@$(MAKE) /nologo /f makefile.msv $@
cd ..
cd psapi
@$(MAKE) /nologo /f makefile.msv $@
cd ..
clean :
cd msimg32
@$(MAKE) /nologo /f makefile.msv $@
cd ..
cd pdh
@$(MAKE) /nologo /f makefile.msv $@
cd ..
cd wtsapi32
@$(MAKE) /nologo /f makefile.msv $@
cd ..
cd uxtheme
@$(MAKE) /nologo /f makefile.msv $@
cd ..
cd psapi
@$(MAKE) /nologo /f makefile.msv $@
cd ..
ide : all clean
-@if exist Release\NUL rd Release

View File

@ -0,0 +1,42 @@
# Makefile for GNU C Compiler (GCC)
CC = gcc
CXX = g++
RCC = windres
OBJ = msimg32.o
RES = msimgme.o
LIBS = -nostdlib -lkernel32 -lgdi32
LDFLAGS = -s -shared -Wl,--kill-at -e _DllMain@12 -Wl,--enable-stdcall-fixup
BIN = ..\msimg32.dll
CFLAGS = -O2 -Wall
CXXFLAGS = $(CFLAGS)
.SUFFIXES: .rc
all : $(BIN)
.PHONY : clean
clean :
-@if exist *.o del *.o
-@if exist *.po del *.po
-@if exist *.a del *.a
realclean : clean
-@if exist $(BIN) del $(BIN)
$(BIN) : $(OBJ) $(RES)
$(CXX) $(LDFLAGS) -o $(BIN) msimg32.def $(OBJ) $(RES) $(LIBS)
.c.o :
$(CC) $(CFLAGS) -c -MMD -MF $*.po -o $@ $<
.cpp.o :
$(CXX) $(CXXFLAGS) -c -MMD -MF $*.po -o $@ $<
.rc.o :
$(RCC) $< $@
.def.a :
dlltool --def $< -l $@
-include $(OBJ:.o=.po)

View File

@ -0,0 +1,32 @@
# Makefile for Microsoft Visual C++ Compiler (MSVC)
OBJ = msimg32.obj
RES = msimgme.res
DEF = /DEF:msimg32.def
BIN = ..\msimg32.dll
LIBS = -nodefaultlib kernel32.lib gdi32.lib
LDFLAGS = /DLL /OPT:NOWIN98 /ENTRY:DllMain@12
CFLAGS = /W3 /O2 /Oi /FD
CXXFLAGS = $(CFLAGS)
all : $(BIN)
-@if exist $(BIN:.dll=.exp) del $(BIN:.dll=.exp)
-@if exist $(BIN:.dll=.lib) del $(BIN:.dll=.lib)
.PHONY : clean
clean :
-@if exist *.obj del *.obj
-@if exist *.idb del *.idb
-@if exist *.res del *.res
realclean : clean
-@if exist $(BIN) del $(BIN)
$(BIN) : $(OBJ) $(RES)
link /nologo $(LDFLAGS) $(DEF) /OUT:$(BIN) $(LIBS) $(OBJ) $(RES)
.c.obj :
cl /nologo $(CFLAGS) /c /Fo$@ $<
.cpp.obj :
cl /nologo $(CXXFLAGS) /c /Fo$@ $<

386
auxiliary/msimg32/msimg32.c Normal file
View File

@ -0,0 +1,386 @@
/*
* KernelEx
* Copyright (C) 2008, Tihiy
* Copyright 1993, 1994 Alexandre Julliard
* Copyright 1997 Bertho A. Stultiens
* 1999 Huw D M Davies
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <windows.h>
#define INITBITMAPINFO(bInfo,cx,cy) \
ZeroMemory(&bInfo,sizeof(BITMAPINFO)); \
bInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); \
bInfo.bmiHeader.biWidth = cx; \
bInfo.bmiHeader.biHeight = cy; \
bInfo.bmiHeader.biPlanes = 1; \
bInfo.bmiHeader.biBitCount = 32;
typedef struct tagRGBALPHA {
byte rgbRed;
byte rgbGreen;
byte rgbBlue;
byte rgbReserved;
} RGBALPHA,*PRGBALPHA;
#ifndef GRADIENT_FILL_RECT_H
#define GRADIENT_FILL_RECT_H 0x00
#define GRADIENT_FILL_RECT_V 0x01
#define GRADIENT_FILL_TRIANGLE 0x02
#define GRADIENT_FILL_OP_FLAG 0xff
#endif
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
DisableThreadLibraryCalls(hinstDLL);
return TRUE;
}
BOOL WINAPI AlphaBlend_NEW( HDC hdcDest, // handle to destination DC
int nXOriginDest, // x-coord of upper-left corner
int nYOriginDest, // y-coord of upper-left corner
int nWidthDest, // destination width
int nHeightDest, // destination height
HDC hdcSrc, // handle to source DC
int nXOriginSrc, // x-coord of upper-left corner
int nYOriginSrc, // y-coord of upper-left corner
int nWidthSrc, // source width
int nHeightSrc, // source height
BLENDFUNCTION blendFunction // alpha-blending function
)
{
unsigned int i, srcalpha, dstalpha;
BITMAPINFO bmi;
HBITMAP srcBM, dstBM, dcBM;
HDC srcDC, dstDC;
PRGBALPHA srcPixel, dstPixel;
INITBITMAPINFO(bmi,nWidthDest,nHeightDest);
if ( !hdcDest || !hdcSrc || blendFunction.BlendOp != AC_SRC_OVER )
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if ( !blendFunction.SourceConstantAlpha ) return TRUE; //nothing to do
if ( !blendFunction.AlphaFormat && blendFunction.SourceConstantAlpha == 0xFF ) //no alpha work
return StretchBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, SRCCOPY );
srcBM = CreateDIBSection(hdcSrc, &bmi, DIB_RGB_COLORS, (void*)&srcPixel, NULL, 0);
dstBM = CreateDIBSection(hdcDest, &bmi, DIB_RGB_COLORS, (void*)&dstPixel, NULL, 0);
if ( !srcBM || !dstBM )
{
DeleteObject(srcBM);
DeleteObject(dstBM);
return FALSE;
}
//create a copy of source image
srcDC = CreateCompatibleDC(hdcSrc);
dcBM = SelectObject(srcDC, srcBM);
StretchBlt(srcDC, 0, 0, nWidthDest, nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, SRCCOPY);
SelectObject(srcDC, dcBM);
DeleteDC(srcDC); //don't need no more
//create a copy of dest image
dstDC = CreateCompatibleDC(hdcDest);
dcBM = SelectObject(dstDC, dstBM);
BitBlt(dstDC, 0, 0, nWidthDest, nHeightDest, hdcDest, nXOriginDest, nYOriginDest, SRCCOPY);
//workwork
if ( !blendFunction.AlphaFormat ) //no alpha channel
{
srcalpha = blendFunction.SourceConstantAlpha;
dstalpha = 255 - srcalpha;
for (i = 0; i < (nWidthDest*nHeightDest); i++)
{
dstPixel->rgbBlue = ( (srcPixel->rgbBlue * srcalpha) + (dstPixel->rgbBlue * dstalpha) ) / 255;
dstPixel->rgbGreen = ( (srcPixel->rgbGreen * srcalpha) + (dstPixel->rgbGreen * dstalpha) ) / 255;
dstPixel->rgbRed = ( (srcPixel->rgbRed * srcalpha) + (dstPixel->rgbRed * dstalpha) ) / 255;
dstPixel->rgbReserved = ( (srcPixel->rgbReserved * srcalpha) + (dstPixel->rgbReserved * dstalpha) ) / 255;
srcPixel++;
dstPixel++;
}
}
else
{
unsigned int tmp;
srcalpha = blendFunction.SourceConstantAlpha;
for (i = 0; i < (nWidthDest*nHeightDest); i++)
{
dstalpha = 255 - srcPixel->rgbReserved;
tmp = ((srcPixel->rgbRed * srcalpha) + (dstPixel->rgbRed * dstalpha)) / 255;
if (tmp > 255) tmp = 255;
dstPixel->rgbRed = tmp;
tmp = ((srcPixel->rgbGreen * srcalpha) + (dstPixel->rgbGreen * dstalpha)) / 255;
if (tmp > 255) tmp = 255;
dstPixel->rgbGreen = tmp;
tmp = ((srcPixel->rgbBlue * srcalpha) + (dstPixel->rgbBlue * dstalpha)) / 255;
if (tmp > 255) tmp = 255;
dstPixel->rgbBlue = tmp;
tmp = ((srcPixel->rgbReserved * srcalpha) + (dstPixel->rgbReserved * dstalpha)) / 255;
if (tmp > 255) tmp = 255;
dstPixel->rgbReserved = tmp;
srcPixel++;
dstPixel++;
}
}
BitBlt(hdcDest,nXOriginDest,nYOriginDest,nWidthDest,nHeightDest,dstDC,0,0,SRCCOPY);
//destroy stuff we used
SelectObject(dstDC, dcBM);
DeleteDC(dstDC);
DeleteObject(srcBM);
DeleteObject(dstBM);
return TRUE;
}
/******************************************************************************
* GdiGradientFill (GDI32.@)
*
* FIXME: we don't support the Alpha channel properly
*/
BOOL WINAPI GradientFill_NEW( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
void * grad_array, ULONG ngrad, ULONG mode )
{
unsigned int i;
if ( !hdc || !vert_array || ! grad_array )
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
switch(mode)
{
case GRADIENT_FILL_RECT_H:
for(i = 0; i < ngrad; i++)
{
GRADIENT_RECT *rect = ((GRADIENT_RECT *)grad_array) + i;
TRIVERTEX *v1 = vert_array + rect->UpperLeft;
TRIVERTEX *v2 = vert_array + rect->LowerRight;
int y1 = v1->y < v2->y ? v1->y : v2->y;
int y2 = v2->y > v1->y ? v2->y : v1->y;
int x, dx;
if (v1->x > v2->x)
{
TRIVERTEX *t = v2;
v2 = v1;
v1 = t;
}
dx = v2->x - v1->x;
for (x = 0; x < dx; x++)
{
POINT pts[2];
HPEN hPen, hOldPen;
hPen = CreatePen( PS_SOLID, 1, RGB(
(v1->Red * (dx - x) + v2->Red * x) / dx >> 8,
(v1->Green * (dx - x) + v2->Green * x) / dx >> 8,
(v1->Blue * (dx - x) + v2->Blue * x) / dx >> 8));
hOldPen = SelectObject( hdc, hPen );
pts[0].x = v1->x + x;
pts[0].y = y1;
pts[1].x = v1->x + x;
pts[1].y = y2;
Polyline( hdc, &pts[0], 2 );
DeleteObject( SelectObject(hdc, hOldPen ) );
}
}
break;
case GRADIENT_FILL_RECT_V:
for(i = 0; i < ngrad; i++)
{
GRADIENT_RECT *rect = ((GRADIENT_RECT *)grad_array) + i;
TRIVERTEX *v1 = vert_array + rect->UpperLeft;
TRIVERTEX *v2 = vert_array + rect->LowerRight;
int x1 = v1->x < v2->x ? v1->x : v2->x;
int x2 = v2->x > v1->x ? v2->x : v1->x;
int y, dy;
if (v1->y > v2->y)
{
TRIVERTEX *t = v2;
v2 = v1;
v1 = t;
}
dy = v2->y - v1->y;
for (y = 0; y < dy; y++)
{
POINT pts[2];
HPEN hPen, hOldPen;
hPen = CreatePen( PS_SOLID, 1, RGB(
(v1->Red * (dy - y) + v2->Red * y) / dy >> 8,
(v1->Green * (dy - y) + v2->Green * y) / dy >> 8,
(v1->Blue * (dy - y) + v2->Blue * y) / dy >> 8));
hOldPen = SelectObject( hdc, hPen );
pts[0].x = x1;
pts[0].y = v1->y + y;
pts[1].x = x2;
pts[1].y = v1->y + y;
Polyline( hdc, &pts[0], 2 );
DeleteObject( SelectObject(hdc, hOldPen ) );
}
}
break;
case GRADIENT_FILL_TRIANGLE:
for (i = 0; i < ngrad; i++)
{
GRADIENT_TRIANGLE *tri = ((GRADIENT_TRIANGLE *)grad_array) + i;
TRIVERTEX *v1 = vert_array + tri->Vertex1;
TRIVERTEX *v2 = vert_array + tri->Vertex2;
TRIVERTEX *v3 = vert_array + tri->Vertex3;
int y, dy;
if (v1->y > v2->y)
{ TRIVERTEX *t = v1; v1 = v2; v2 = t; }
if (v2->y > v3->y)
{
TRIVERTEX *t = v2; v2 = v3; v3 = t;
if (v1->y > v2->y)
{ t = v1; v1 = v2; v2 = t; }
}
/* v1->y <= v2->y <= v3->y */
dy = v3->y - v1->y;
for (y = 0; y < dy; y++)
{
/* v1->y <= y < v3->y */
TRIVERTEX *v = y < (v2->y - v1->y) ? v1 : v3;
/* (v->y <= y < v2->y) || (v2->y <= y < v->y) */
int dy2 = v2->y - v->y;
int y2 = y + v1->y - v->y;
int x1 = (v3->x * y + v1->x * (dy - y )) / dy;
int x2 = (v2->x * y2 + v-> x * (dy2 - y2)) / dy2;
int r1 = (v3->Red * y + v1->Red * (dy - y )) / dy;
int r2 = (v2->Red * y2 + v-> Red * (dy2 - y2)) / dy2;
int g1 = (v3->Green * y + v1->Green * (dy - y )) / dy;
int g2 = (v2->Green * y2 + v-> Green * (dy2 - y2)) / dy2;
int b1 = (v3->Blue * y + v1->Blue * (dy - y )) / dy;
int b2 = (v2->Blue * y2 + v-> Blue * (dy2 - y2)) / dy2;
int x;
if (x1 < x2)
{
int dx = x2 - x1;
for (x = 0; x < dx; x++)
SetPixel (hdc, x + x1, y + v1->y, RGB(
(r1 * (dx - x) + r2 * x) / dx >> 8,
(g1 * (dx - x) + g2 * x) / dx >> 8,
(b1 * (dx - x) + b2 * x) / dx >> 8));
}
else
{
int dx = x1 - x2;
for (x = 0; x < dx; x++)
SetPixel (hdc, x + x2, y + v1->y, RGB(
(r2 * (dx - x) + r1 * x) / dx >> 8,
(g2 * (dx - x) + g1 * x) / dx >> 8,
(b2 * (dx - x) + b1 * x) / dx >> 8));
}
}
}
break;
default:
return FALSE;
}
return TRUE;
}
/******************************************************************************
* GdiTransparentBlt [GDI32.@]
*/
BOOL WINAPI TransparentBlt_NEW( HDC hdcDest, int xDest, int yDest, int widthDest, int heightDest,
HDC hdcSrc, int xSrc, int ySrc, int widthSrc, int heightSrc,
UINT crTransparent )
{
BOOL ret = FALSE;
HDC hdcWork;
HBITMAP bmpWork;
HGDIOBJ oldWork;
HDC hdcMask = NULL;
HBITMAP bmpMask = NULL;
HBITMAP oldMask = NULL;
COLORREF oldBackground;
COLORREF oldForeground;
int oldStretchMode;
if ( !hdcDest || !hdcSrc )
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if(widthDest < 0 || heightDest < 0 || widthSrc < 0 || heightSrc < 0) {
return FALSE;
}
oldBackground = SetBkColor(hdcDest, RGB(255,255,255));
oldForeground = SetTextColor(hdcDest, RGB(0,0,0));
/* Stretch bitmap */
oldStretchMode = GetStretchBltMode(hdcSrc);
if(oldStretchMode == BLACKONWHITE || oldStretchMode == WHITEONBLACK)
SetStretchBltMode(hdcSrc, COLORONCOLOR);
hdcWork = CreateCompatibleDC(hdcDest);
bmpWork = CreateCompatibleBitmap(hdcDest, widthDest, heightDest);
oldWork = SelectObject(hdcWork, bmpWork);
if(!StretchBlt(hdcWork, 0, 0, widthDest, heightDest, hdcSrc, xSrc, ySrc, widthSrc, heightSrc, SRCCOPY)) goto error;
SetBkColor(hdcWork, crTransparent);
/* Create mask */
hdcMask = CreateCompatibleDC(hdcDest);
bmpMask = CreateCompatibleBitmap(hdcMask, widthDest, heightDest);
oldMask = SelectObject(hdcMask, bmpMask);
if(!BitBlt(hdcMask, 0, 0, widthDest, heightDest, hdcWork, 0, 0, SRCCOPY)) goto error;
/* Replace transparent color with black */
SetBkColor(hdcWork, RGB(0,0,0));
SetTextColor(hdcWork, RGB(255,255,255));
if(!BitBlt(hdcWork, 0, 0, widthDest, heightDest, hdcMask, 0, 0, SRCAND)) goto error;
/* Replace non-transparent area on destination with black */
if(!BitBlt(hdcDest, xDest, yDest, widthDest, heightDest, hdcMask, 0, 0, SRCAND)) goto error;
/* Draw the image */
if(!BitBlt(hdcDest, xDest, yDest, widthDest, heightDest, hdcWork, 0, 0, SRCPAINT)) goto error;
ret = TRUE;
error:
SetStretchBltMode(hdcSrc, oldStretchMode);
SetBkColor(hdcDest, oldBackground);
SetTextColor(hdcDest, oldForeground);
if(hdcWork) {
SelectObject(hdcWork, oldWork);
DeleteDC(hdcWork);
}
if(bmpWork) DeleteObject(bmpWork);
if(hdcMask) {
SelectObject(hdcMask, oldMask);
DeleteDC(hdcMask);
}
if(bmpMask) DeleteObject(bmpMask);
return ret;
}
void WINAPI vSetDdrawflag()
{
return;
}

View File

@ -0,0 +1,8 @@
LIBRARY msimg32.dll BASE=0x79790000
EXPORTS
vSetDdrawflag @1
AlphaBlend = AlphaBlend_NEW @2
DllInitialize = DllMain @3 PRIVATE
GradientFill = GradientFill_NEW @4
TransparentBlt = TransparentBlt_NEW @5

View File

@ -0,0 +1,26 @@
1 VERSIONINFO
FILEVERSION 5,0,2218,1
PRODUCTVERSION 5,0,2218,1
FILEOS 0x40004
FILETYPE 0x2
{
BLOCK "StringFileInfo"
{
BLOCK "040904B0"
{
VALUE "CompanyName", "KernelEx"
VALUE "FileDescription", "GDIEXT Client DLL"
VALUE "FileVersion", "5.00.2218.1 (KernelEx special version)"
VALUE "InternalName", "gdiext"
VALUE "LegalCopyright", "Tihiy"
VALUE "OriginalFilename", "gdiext"
VALUE "ProductName", "KernelEx supplementary libraries"
VALUE "ProductVersion", "5.00.2218.1"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0409, 0x04B0
}
}

5
auxiliary/pdh/kord.def Normal file
View File

@ -0,0 +1,5 @@
LIBRARY KERNEL32.dll
EXPORTS
CommonUnimpStub@0 @17 NONAME

43
auxiliary/pdh/makefile Normal file
View File

@ -0,0 +1,43 @@
# Makefile for GNU C Compiler (GCC)
CC = gcc
CXX = g++
RCC = windres
OBJ = pdh.o
RES =
DEF = pdh.def
LIBS = kord.a -nostdlib -lkernel32
LDFLAGS = -s -shared -e _DllMain@12 -Wl,--enable-stdcall-fixup
BIN = ..\pdh.dll
CFLAGS = -Os -Wall
CXXFLAGS = $(CFLAGS)
.SUFFIXES: .rc
all : $(BIN)
.PHONY : clean
clean :
-@if exist *.o del *.o
-@if exist *.po del *.po
-@if exist *.a del *.a
realclean : clean
-@if exist $(BIN) del $(BIN)
$(BIN) : $(OBJ) $(RES) kord.a
$(CXX) $(LDFLAGS) -o $(BIN) $(OBJ) $(RES) $(LIBS) $(DEF)
.c.o :
$(CC) $(CFLAGS) -c -MMD -MF $*.po -o $@ $<
.cpp.o :
$(CXX) $(CXXFLAGS) -c -MMD -MF $*.po -o $@ $<
.rc.o :
$(RCC) $< $@
.def.a :
dlltool --def $< -l $@
-include $(OBJ:.o=.po)

View File

@ -0,0 +1,38 @@
# Makefile for Microsoft Visual C++ Compiler (MSVC)
OBJ = kord.lib pdh.obj
RES =
DEF = /DEF:pdh.def
BIN = ..\pdh.dll
LIBS = -nodefaultlib kernel32.lib gdi32.lib
LDFLAGS = /DLL /OPT:NOWIN98 /ENTRY:DllMain@12
CFLAGS = /W3 /O2 /Oi /FD
CXXFLAGS = $(CFLAGS)
all : $(BIN)
-@if exist $(BIN:.dll=.exp) del $(BIN:.dll=.exp)
-@if exist $(BIN:.dll=.lib) del $(BIN:.dll=.lib)
.PHONY : clean
clean :
-@if exist *.obj del *.obj
-@if exist *.idb del *.idb
-@if exist *.res del *.res
-@if exist *.exp del *.exp
-@if exist *.lib del *.lib
realclean : clean
-@if exist $(BIN) del $(BIN)
$(BIN) : $(OBJ) $(RES)
link /nologo $(LDFLAGS) $(DEF) /OUT:$(BIN) $(LIBS) $(OBJ) $(RES)
.c.obj :
cl /nologo $(CFLAGS) /c /Fo$@ $<
.cpp.obj :
cl /nologo $(CXXFLAGS) /c /Fo$@ $<
kord.lib : kord.def
link /LIB /NOLOGO /MACHINE:IX86 /DEF:$? /OUT:$@

137
auxiliary/pdh/pdh.c Normal file
View File

@ -0,0 +1,137 @@
/*
* KernelEx
* Copyright (C) 2007, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <windows.h>
int WINAPI CommonUnimpStub(void);
#ifdef __GNUC__
#define UNIMPL_FUNC(name,params) \
__asm__( ".text\n" \
".globl _" #name "@0\n" \
"_" #name "_new@0:\n\t" \
"xor %eax, %eax\n\t" \
"movb $" #params ", %cl\n\t" \
"jmp _CommonUnimpStub@0\n\t" \
)
#else
#define UNIMPL_FUNC(name,params) \
int __declspec(naked) __stdcall name() \
{ \
__asm xor eax,eax \
__asm mov cl, params \
__asm jmp CommonUnimpStub \
}
#endif
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
{
OSVERSIONINFO osv;
osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osv);
if (osv.dwMajorVersion < 5)
return FALSE;
DisableThreadLibraryCalls(hinstDLL);
break;
}
case DLL_PROCESS_DETACH:
{
break;
}
}
return TRUE;
}
UNIMPL_FUNC(PdhGetDllVersion, 1);
UNIMPL_FUNC(PdhOpenQueryA, 3);
UNIMPL_FUNC(PdhOpenQueryW, 3);
UNIMPL_FUNC(PdhAddCounterA, 4);
UNIMPL_FUNC(PdhAddCounterW, 4);
UNIMPL_FUNC(PdhRemoveCounter, 1);
UNIMPL_FUNC(PdhCollectQueryData, 1);
UNIMPL_FUNC(PdhCloseQuery, 1);
UNIMPL_FUNC(PdhGetFormattedCounterValue, 4);
UNIMPL_FUNC(PdhGetFormattedCounterArrayA, 5);
UNIMPL_FUNC(PdhGetFormattedCounterArrayW, 5);
UNIMPL_FUNC(PdhGetRawCounterValue, 3);
UNIMPL_FUNC(PdhGetRawCounterArrayA, 4);
UNIMPL_FUNC(PdhGetRawCounterArrayW, 4);
UNIMPL_FUNC(PdhCalculateCounterFromRawValue, 5);
UNIMPL_FUNC(PdhComputeCounterStatistics, 6);
UNIMPL_FUNC(PdhGetCounterInfoA, 4);
UNIMPL_FUNC(PdhGetCounterInfoW, 4);
UNIMPL_FUNC(PdhSetCounterScaleFactor, 2);
UNIMPL_FUNC(PdhConnectMachineA, 1);
UNIMPL_FUNC(PdhConnectMachineW, 1);
UNIMPL_FUNC(PdhEnumMachinesA, 3);
UNIMPL_FUNC(PdhEnumMachinesW, 3);
UNIMPL_FUNC(PdhEnumObjectsA, 6);
UNIMPL_FUNC(PdhEnumObjectsW, 6);
UNIMPL_FUNC(PdhEnumObjectItemsA, 9);
UNIMPL_FUNC(PdhEnumObjectItemsW, 9);
UNIMPL_FUNC(PdhMakeCounterPathA, 4);
UNIMPL_FUNC(PdhMakeCounterPathW, 4);
UNIMPL_FUNC(PdhParseCounterPathA, 4);
UNIMPL_FUNC(PdhParseCounterPathW, 4);
UNIMPL_FUNC(PdhParseInstanceNameA, 6);
UNIMPL_FUNC(PdhParseInstanceNameW, 6);
UNIMPL_FUNC(PdhValidatePathA, 1);
UNIMPL_FUNC(PdhValidatePathW, 1);
UNIMPL_FUNC(PdhGetDefaultPerfObjectA, 4);
UNIMPL_FUNC(PdhGetDefaultPerfObjectW, 4);
UNIMPL_FUNC(PdhGetDefaultPerfCounterA, 5);
UNIMPL_FUNC(PdhGetDefaultPerfCounterW, 5);
UNIMPL_FUNC(PdhBrowseCountersA, 1);
UNIMPL_FUNC(PdhBrowseCountersW, 1);
UNIMPL_FUNC(PdhExpandCounterPathA, 3);
UNIMPL_FUNC(PdhExpandCounterPathW, 3);
UNIMPL_FUNC(PdhLookupPerfNameByIndexA, 4);
UNIMPL_FUNC(PdhLookupPerfNameByIndexW, 4);
UNIMPL_FUNC(PdhLookupPerfIndexByNameA, 3);
UNIMPL_FUNC(PdhLookupPerfIndexByNameW, 3);
UNIMPL_FUNC(PdhOpenLogA, 7);
UNIMPL_FUNC(PdhOpenLogW, 7);
UNIMPL_FUNC(PdhUpdateLogA, 2);
UNIMPL_FUNC(PdhUpdateLogW, 2);
UNIMPL_FUNC(PdhGetLogFileSize, 2);
UNIMPL_FUNC(PdhCloseLog, 2);
UNIMPL_FUNC(PdhSelectDataSourceA, 4);
UNIMPL_FUNC(PdhSelectDataSourceW, 4);
UNIMPL_FUNC(PdhIsRealTimeQuery, 1);
UNIMPL_FUNC(PdhSetQueryTimeRange, 2);
UNIMPL_FUNC(PdhGetDataSourceTimeRangeA, 4);
UNIMPL_FUNC(PdhGetDataSourceTimeRangeW, 4);
UNIMPL_FUNC(PdhCollectQueryDataEx, 3);
UNIMPL_FUNC(PdhFormatFromRawValue, 6);
UNIMPL_FUNC(PdhGetCounterTimeBase, 2);
UNIMPL_FUNC(PdhEncodeWmiPathA, 5);
UNIMPL_FUNC(PdhEncodeWmiPathW, 5);
UNIMPL_FUNC(PdhDecodeWmiPathA, 5);
UNIMPL_FUNC(PdhDecodeWmiPathW, 5);
UNIMPL_FUNC(PdhReadRawLogRecord, 4);
UNIMPL_FUNC(PdhLogServiceCommandA, 4);
UNIMPL_FUNC(PdhLogServiceCommandW, 4);
UNIMPL_FUNC(PdhLogServiceControlA, 5);
UNIMPL_FUNC(PdhLogServiceControlW, 5);

73
auxiliary/pdh/pdh.def Normal file
View File

@ -0,0 +1,73 @@
LIBRARY pdh.dll BASE=0x7D050000
EXPORTS
PdhGetDllVersion
PdhOpenQueryA
PdhOpenQueryW
PdhAddCounterA
PdhAddCounterW
PdhRemoveCounter
PdhCollectQueryData
PdhCloseQuery
PdhGetFormattedCounterValue
PdhGetFormattedCounterArrayA
PdhGetFormattedCounterArrayW
PdhGetRawCounterValue
PdhGetRawCounterArrayA
PdhGetRawCounterArrayW
PdhCalculateCounterFromRawValue
PdhComputeCounterStatistics
PdhGetCounterInfoA
PdhGetCounterInfoW
PdhSetCounterScaleFactor
PdhConnectMachineA
PdhConnectMachineW
PdhEnumMachinesA
PdhEnumMachinesW
PdhEnumObjectsA
PdhEnumObjectsW
PdhEnumObjectItemsA
PdhEnumObjectItemsW
PdhMakeCounterPathA
PdhMakeCounterPathW
PdhParseCounterPathA
PdhParseCounterPathW
PdhParseInstanceNameA
PdhParseInstanceNameW
PdhValidatePathA
PdhValidatePathW
PdhGetDefaultPerfObjectA
PdhGetDefaultPerfObjectW
PdhGetDefaultPerfCounterA
PdhGetDefaultPerfCounterW
PdhBrowseCountersA
PdhBrowseCountersW
PdhExpandCounterPathA
PdhExpandCounterPathW
PdhLookupPerfNameByIndexA
PdhLookupPerfNameByIndexW
PdhLookupPerfIndexByNameA
PdhLookupPerfIndexByNameW
PdhOpenLogA
PdhOpenLogW
PdhUpdateLogA
PdhUpdateLogW
PdhGetLogFileSize
PdhCloseLog
PdhSelectDataSourceA
PdhSelectDataSourceW
PdhIsRealTimeQuery
PdhSetQueryTimeRange
PdhGetDataSourceTimeRangeA
PdhGetDataSourceTimeRangeW
PdhCollectQueryDataEx
PdhFormatFromRawValue
PdhGetCounterTimeBase
PdhEncodeWmiPathA
PdhEncodeWmiPathW
PdhDecodeWmiPathA
PdhDecodeWmiPathW
PdhReadRawLogRecord
PdhLogServiceCommandA
PdhLogServiceCommandW
PdhLogServiceControlA
PdhLogServiceControlW

43
auxiliary/psapi/makefile Normal file
View File

@ -0,0 +1,43 @@
# Makefile for GNU C Compiler (GCC)
CC = gcc
CXX = g++
RCC = windres
OBJ = psapi.o
RES =
DEF = psapi.def
LIBS = -nostdlib -lkernel32
LDFLAGS = -s -shared -Wl,--enable-stdcall-fixup -e _DllMain@12
BIN = ..\psapi.dll
CFLAGS = -Os -Wall
CXXFLAGS = $(CFLAGS)
.SUFFIXES: .rc
all : $(BIN)
.PHONY : clean
clean :
-@if exist *.o del *.o
-@if exist *.po del *.po
-@if exist *.a del *.a
realclean : clean
-@if exist $(BIN) del $(BIN)
$(BIN) : $(OBJ) $(RES)
$(CXX) $(LDFLAGS) -o $(BIN) $(OBJ) $(RES) $(DEF) $(LIBS)
.c.o :
$(CC) $(CFLAGS) -c -MMD -MF $*.po -o $@ $<
.cpp.o :
$(CXX) $(CXXFLAGS) -c -MMD -MF $*.po -o $@ $<
.rc.o :
$(RCC) $< $@
.def.a :
dlltool --def $< -l $@
-include $(OBJ:.o=.po)

View File

@ -0,0 +1,32 @@
# Makefile for Microsoft Visual C++ Compiler (MSVC)
OBJ = psapi.obj
RES =
DEF = /DEF:psapi.def
BIN = ..\psapi.dll
LIBS = -nodefaultlib kernel32.lib
LDFLAGS = /DLL /OPT:NOWIN98 /ENTRY:DllMain@12
CFLAGS = /W3 /O2 /Oi /FD
CXXFLAGS = $(CFLAGS)
all : $(BIN)
-@if exist $(BIN:.dll=.exp) del $(BIN:.dll=.exp)
-@if exist $(BIN:.dll=.lib) del $(BIN:.dll=.lib)
.PHONY : clean
clean :
-@if exist *.obj del *.obj
-@if exist *.idb del *.idb
-@if exist *.res del *.res
realclean : clean
-@if exist $(BIN) del $(BIN)
$(BIN) : $(OBJ) $(RES)
link /nologo $(LDFLAGS) $(DEF) /OUT:$(BIN) $(LIBS) $(OBJ) $(RES)
.c.obj :
cl /nologo $(CFLAGS) /c /Fo$@ $<
.cpp.obj :
cl /nologo $(CXXFLAGS) /c /Fo$@ $<

348
auxiliary/psapi/psapi.c Normal file
View File

@ -0,0 +1,348 @@
/*
* KernelEx
* Copyright (C) 2008, Tihiy
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <windows.h>
#include <tlhelp32.h>
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
DisableThreadLibraryCalls(hinstDLL);
return TRUE;
}
DWORD WINAPI GetProcessFlags(
HANDLE ProcessID
)
{
typedef DWORD (WINAPI *GPF) (HANDLE ProcessID);
static GPF g_GetProcessFlags = 0;
if ( !g_GetProcessFlags ) g_GetProcessFlags = (GPF) GetProcAddress(GetModuleHandle("kernel32.dll"),"GetProcessFlags");
return g_GetProcessFlags(ProcessID);
}
/* Retrieves the process identifier of the specified process.
dumb facts:
- most reliable relative code ever
- yes, kernel32 on XP+ does export this function. we make 98 too :p */
DWORD WINAPI GetProcessId(
HANDLE hProcess
)
{
typedef DWORD (WINAPI *MPH) (HANDLE hProcess);
static MPH MapProcessHandle = 0;
if (!MapProcessHandle)
{
DWORD *faddr;
DWORD addr;
faddr = (DWORD *) ( (DWORD)GetProcAddress(GetModuleHandle("kernel32.dll"),"SetFilePointer") + 0x1D ); //there is jmp _SetFilePointer
addr = (DWORD) faddr + *faddr + 4 - 0x16; //0x16 bytes before _SetFilePointer there is MapProcessHandle, just what we need
faddr = (DWORD *) addr;
if (*faddr != 0x206A006A) return FALSE; //push 0; push 0x20
MapProcessHandle = (MPH) addr;
}
return MapProcessHandle(hProcess);
}
/* Enumerate processes in the system into array.
dumb facts:
- uses byte size instead of dword
- checks output buffers for access */
BOOL WINAPI EnumProcesses(
DWORD *pProcessIds,
DWORD cb,
DWORD *pBytesReturned
)
{
PROCESSENTRY32 oneprocess;
HANDLE hSnap;
if ( cb < sizeof(DWORD) ) return FALSE;
cb = cb & ~sizeof(DWORD); //you don't want to get a quarter of a process
if ( IsBadWritePtr(pProcessIds,sizeof(DWORD)) || IsBadWritePtr(pBytesReturned,sizeof(DWORD)) )
{
SetLastError(ERROR_NOACCESS);
return FALSE;
}
hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
if (hSnap == INVALID_HANDLE_VALUE) return FALSE;
oneprocess.dwSize = sizeof(PROCESSENTRY32);
if ( Process32First(hSnap, &oneprocess) )
{
*pProcessIds = oneprocess.th32ProcessID;
pProcessIds++;
*pBytesReturned = sizeof(DWORD);
while ( Process32Next(hSnap, &oneprocess) && *pBytesReturned<cb )
{
if ( (GetProcessFlags((HANDLE)oneprocess.th32ProcessID) & 8) != 8 ) //skip 16-bit processes!
{
*pProcessIds = oneprocess.th32ProcessID;
pProcessIds++;
*pBytesReturned += sizeof(DWORD);
}
}
}
CloseHandle(hSnap);
return TRUE;
}
/* EPIC FAIL: Module32First may often not return actual exe hModule. We will work this around hardly!*/
static DWORD FindProcessMID(HANDLE hSnap, DWORD pid)
{
PROCESSENTRY32 oneprocess;
oneprocess.dwSize = sizeof(PROCESSENTRY32);
Process32First(hSnap,&oneprocess);
while ( oneprocess.th32ProcessID != pid )
{
if ( !Process32Next(hSnap,&oneprocess) )
return FALSE;
}
return oneprocess.th32ModuleID;
}
/* Enumerate module handles in a processes into array.
dumb facts:
- uses byte size instead of dword
- checks output buffers for access
- uses NOT the same rules as EnumProcesses: returns actually needed, not filled bytes! */
BOOL WINAPI EnumProcessModules(
HANDLE hProcess,
HMODULE *lphModule,
DWORD cb,
DWORD *lpcbNeeded
)
{
MODULEENTRY32 onemodule;
BOOL lRet;
DWORD pid;
DWORD ProcessModuleID;
HMODULE *lphModuleStart;
HANDLE hSnap;
lphModuleStart = lphModule;
if ( cb < sizeof(DWORD) ) return FALSE;
cb = cb & ~sizeof(DWORD); //you don't want to get a quarter of a module
if ( IsBadWritePtr(lphModule,sizeof(DWORD)) || IsBadWritePtr(lpcbNeeded,sizeof(DWORD)) )
{
SetLastError(ERROR_NOACCESS);
return FALSE;
}
pid = GetProcessId(hProcess);
hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS,pid);
if (hSnap == INVALID_HANDLE_VALUE) return FALSE;
ProcessModuleID = FindProcessMID(hSnap,pid);
if ( !ProcessModuleID )
{
CloseHandle(hSnap);
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
onemodule.dwSize = sizeof(MODULEENTRY32);
lRet = Module32First(hSnap, &onemodule);
*lpcbNeeded = 0;
while ( lRet )
{
if (cb>*lpcbNeeded)
{
if ( onemodule.th32ModuleID == ProcessModuleID )
{
//current element gets first value, first gets current
*lphModule = *lphModuleStart;
*lphModuleStart = onemodule.hModule;
}
else
*lphModule = onemodule.hModule;
lphModule++;
}
else
if ( onemodule.th32ModuleID == ProcessModuleID ) *lphModuleStart = onemodule.hModule;
*lpcbNeeded += sizeof(DWORD);
lRet = Module32Next(hSnap, &onemodule);
}
CloseHandle(hSnap);
return TRUE;
}
/* find module/process full/short path in ansi/unicode */
static DWORD WINAPI GetModuleSuperName(
HANDLE hProcess,
HMODULE hModule,
LPTSTR lpFilename,
DWORD nSize,
BOOL fUnicode,
BOOL fFullName
)
{
MODULEENTRY32 onemodule;
DWORD pid;
DWORD ProcessModuleID = 0;
HANDLE hSnap;
LPCSTR ModuleName;
if ( !lpFilename || !nSize ) return FALSE;
pid = GetProcessId(hProcess);
onemodule.dwSize = sizeof(MODULEENTRY32);
if ( !hModule )
{
hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS,pid);
if ( hSnap == INVALID_HANDLE_VALUE ) return FALSE;
ProcessModuleID = FindProcessMID(hSnap,pid);
if ( !ProcessModuleID )
{
CloseHandle(hSnap);
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
}
else
{
hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,pid);
}
if ( hSnap == INVALID_HANDLE_VALUE ) return FALSE;
Module32First(hSnap,&onemodule);
while ( onemodule.hModule != hModule && onemodule.th32ModuleID != ProcessModuleID )
{
if ( !Module32Next(hSnap, &onemodule) ) //not found
{
CloseHandle(hSnap);
return FALSE;
}
}
CloseHandle(hSnap);
ModuleName = fFullName ? onemodule.szExePath : onemodule.szModule;
if ( fUnicode )
return MultiByteToWideChar(CP_ACP,0,ModuleName,MAX_MODULE_NAME32,(LPWSTR)lpFilename,nSize);
else
{
int maxLen = ( nSize > MAX_MODULE_NAME32 ) ? MAX_MODULE_NAME32 : nSize;
lstrcpynA(lpFilename,ModuleName,maxLen);
return maxLen;
}
}
DWORD WINAPI GetModuleBaseNameA(
HANDLE hProcess,
HMODULE hModule,
LPCSTR lpBaseName,
DWORD nSize
)
{
return GetModuleSuperName(hProcess,hModule,(LPTSTR)lpBaseName,nSize,FALSE,FALSE);
}
DWORD WINAPI GetModuleBaseNameW(
HANDLE hProcess,
HMODULE hModule,
LPWSTR lpBaseName,
DWORD nSize
)
{
return GetModuleSuperName(hProcess,hModule,(LPTSTR)lpBaseName,nSize,TRUE,FALSE);
}
DWORD WINAPI GetModuleFileNameExA(
HANDLE hProcess,
HMODULE hModule,
LPCSTR lpBaseName,
DWORD nSize
)
{
return GetModuleSuperName(hProcess,hModule,(LPTSTR)lpBaseName,nSize,FALSE,TRUE);
}
DWORD WINAPI GetModuleFileNameExW(
HANDLE hProcess,
HMODULE hModule,
LPWSTR lpBaseName,
DWORD nSize
)
{
return GetModuleSuperName(hProcess,hModule,(LPTSTR)lpBaseName,nSize,TRUE,TRUE);
}
/* BUGBUG those should return NT device path */
DWORD WINAPI GetProcessImageFileNameA(
HANDLE hProcess,
LPCSTR lpImageFileName,
DWORD nSize
)
{
return GetModuleSuperName(hProcess,NULL,(LPTSTR)lpImageFileName,nSize,FALSE,TRUE);
}
DWORD WINAPI GetProcessImageFileNameW(
HANDLE hProcess,
LPWSTR lpImageFileName,
DWORD nSize
)
{
return GetModuleSuperName(hProcess,NULL,(LPTSTR)lpImageFileName,nSize,TRUE,TRUE);
}
//rewrite those somehow, please...
BOOL WINAPI GetProcessMemoryInfo(
HANDLE Process,
DWORD ppsmemCounters,
DWORD cb
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
BOOL WINAPI QueryWorkingSet( HANDLE process, LPVOID buffer, DWORD size )
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
BOOL WINAPI QueryWorkingSetEx( HANDLE process, LPVOID buffer, DWORD size )
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
BOOL WINAPI InitializeProcessForWsWatch( HANDLE hProcess )
{
return TRUE;
}
BOOL WINAPI EnumPageFilesA( PVOID callback, LPVOID context )
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
BOOL WINAPI EnumPageFilesW( PVOID callback, LPVOID context )
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}

18
auxiliary/psapi/psapi.def Normal file
View File

@ -0,0 +1,18 @@
LIBRARY psapi.dll BASE=0x7D020000
EXPORTS
GetProcessFlags
GetProcessId
EnumProcesses
EnumProcessModules
GetModuleBaseNameA
GetModuleBaseNameW
GetModuleFileNameExA
GetModuleFileNameExW
GetProcessImageFileNameA
GetProcessImageFileNameW
GetProcessMemoryInfo
QueryWorkingSet
QueryWorkingSetEx
InitializeProcessForWsWatch
EnumPageFilesA
EnumPageFilesW

View File

@ -0,0 +1,5 @@
LIBRARY KERNEL32.dll
EXPORTS
CommonUnimpStub@0 @17 NONAME

View File

@ -0,0 +1,43 @@
# Makefile for GNU C Compiler (GCC)
CC = gcc
CXX = g++
RCC = windres
OBJ = uxtheme.o
RES =
DEF = uxtheme.def
LIBS = kord.a -nostdlib -lkernel32
LDFLAGS = -s -shared -Wl,--enable-stdcall-fixup -e _DllMain@12
BIN = ..\uxtheme.dll
CFLAGS = -Os -Wall
CXXFLAGS = $(CFLAGS)
.SUFFIXES: .rc
all : $(BIN)
.PHONY : clean
clean :
-@if exist *.o del *.o
-@if exist *.po del *.po
-@if exist *.a del *.a
realclean : clean
-@if exist $(BIN) del $(BIN)
$(BIN) : $(OBJ) $(RES) kord.a
$(CXX) $(LDFLAGS) -o $(BIN) $(OBJ) $(RES) $(LIBS) $(DEF)
.c.o :
$(CC) $(CFLAGS) -c -MMD -MF $*.po -o $@ $<
.cpp.o :
$(CXX) $(CXXFLAGS) -c -MMD -MF $*.po -o $@ $<
.rc.o :
$(RCC) $< $@
.def.a :
dlltool --def $< -l $@
-include $(OBJ:.o=.po)

View File

@ -0,0 +1,38 @@
# Makefile for Microsoft Visual C++ Compiler (MSVC)
OBJ = kord.lib uxtheme.obj
RES =
DEF = /DEF:uxtheme.def
BIN = ..\uxtheme.dll
LIBS = -nodefaultlib kernel32.lib gdi32.lib
LDFLAGS = /DLL /OPT:NOWIN98 /ENTRY:DllMain@12
CFLAGS = /W3 /O2 /Oi /FD
CXXFLAGS = $(CFLAGS)
all : $(BIN)
-@if exist $(BIN:.dll=.exp) del $(BIN:.dll=.exp)
-@if exist $(BIN:.dll=.lib) del $(BIN:.dll=.lib)
.PHONY : clean
clean :
-@if exist *.obj del *.obj
-@if exist *.idb del *.idb
-@if exist *.res del *.res
-@if exist *.exp del *.exp
-@if exist *.lib del *.lib
realclean : clean
-@if exist $(BIN) del $(BIN)
$(BIN) : $(OBJ) $(RES)
link /nologo $(LDFLAGS) $(DEF) /OUT:$(BIN) $(LIBS) $(OBJ) $(RES)
.c.obj :
cl /nologo $(CFLAGS) /c /Fo$@ $<
.cpp.obj :
cl /nologo $(CXXFLAGS) /c /Fo$@ $<
kord.lib : kord.def
link /LIB /NOLOGO /MACHINE:IX86 /DEF:$? /OUT:$@

106
auxiliary/uxtheme/uxtheme.c Normal file
View File

@ -0,0 +1,106 @@
/*
* KernelEx
* Copyright (C) 2008, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <windows.h>
int WINAPI CommonUnimpStub(void);
#ifdef __GNUC__
#define UNIMPL_FUNC(name,params) \
__asm__( ".text\n" \
".globl _" #name "@0\n" \
"_" #name "_new@0:\n\t" \
"xor %eax, %eax\n\t" \
"movb $" #params ", %cl\n\t" \
"jmp _CommonUnimpStub@0\n\t" \
)
#else
#define UNIMPL_FUNC(name,params) \
int __declspec(naked) __stdcall name() \
{ \
__asm xor eax,eax \
__asm mov cl, params \
__asm jmp CommonUnimpStub \
}
#endif
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
{
OSVERSIONINFO osv;
osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osv);
if (osv.dwMajorVersion < 5 || osv.dwMinorVersion < 1)
return FALSE;
DisableThreadLibraryCalls(hinstDLL);
}
return TRUE;
}
UNIMPL_FUNC(CloseThemeData, 1);
UNIMPL_FUNC(DrawThemeBackground, 6);
UNIMPL_FUNC(DrawThemeBackgroundEx, 6);
UNIMPL_FUNC(DrawThemeEdge, 8);
UNIMPL_FUNC(DrawThemeIcon, 7);
UNIMPL_FUNC(DrawThemeParentBackground, 3);
UNIMPL_FUNC(DrawThemeText, 9);
UNIMPL_FUNC(EnableThemeDialogTexture, 2);
UNIMPL_FUNC(EnableTheming, 1);
UNIMPL_FUNC(GetCurrentThemeName, 6);
UNIMPL_FUNC(GetThemeAppProperties, 0);
UNIMPL_FUNC(GetThemeBackgroundContentRect, 6);
UNIMPL_FUNC(GetThemeBackgroundExtent, 6);
UNIMPL_FUNC(GetThemeBackgroundRegion, 6);
UNIMPL_FUNC(GetThemeBool, 5);
UNIMPL_FUNC(GetThemeColor, 5);
UNIMPL_FUNC(GetThemeDocumentationProperty, 4);
UNIMPL_FUNC(GetThemeEnumValue, 5);
UNIMPL_FUNC(GetThemeFilename, 6);
UNIMPL_FUNC(GetThemeFont, 6);
UNIMPL_FUNC(GetThemeInt, 5);
UNIMPL_FUNC(GetThemeIntList, 5);
UNIMPL_FUNC(GetThemeMargins, 7);
UNIMPL_FUNC(GetThemeMetric, 6);
UNIMPL_FUNC(GetThemePartSize, 7);
UNIMPL_FUNC(GetThemePosition, 5);
UNIMPL_FUNC(GetThemePropertyOrigin, 5);
UNIMPL_FUNC(GetThemeRect, 5);
UNIMPL_FUNC(GetThemeString, 6);
UNIMPL_FUNC(GetThemeSysBool, 2);
UNIMPL_FUNC(GetThemeSysColor, 2);
UNIMPL_FUNC(GetThemeSysColorBrush, 2);
UNIMPL_FUNC(GetThemeSysFont, 3);
UNIMPL_FUNC(GetThemeSysInt, 3);
UNIMPL_FUNC(GetThemeSysSize, 2);
UNIMPL_FUNC(GetThemeSysString, 4);
UNIMPL_FUNC(GetThemeTextExtent, 9);
UNIMPL_FUNC(GetThemeTextMetrics, 5);
UNIMPL_FUNC(GetWindowTheme, 1);
UNIMPL_FUNC(HitTestThemeBackground, 10);
UNIMPL_FUNC(IsAppThemed, 0);
UNIMPL_FUNC(IsThemeActive, 0);
UNIMPL_FUNC(IsThemeBackgroundPartiallyTransparent, 3);
UNIMPL_FUNC(IsThemeDialogTextureEnabled, 1);
UNIMPL_FUNC(IsThemePartDefined, 3);
UNIMPL_FUNC(OpenThemeData, 2);
UNIMPL_FUNC(SetThemeAppProperties, 1);
UNIMPL_FUNC(SetWindowTheme, 3);

View File

@ -0,0 +1,50 @@
LIBRARY uxtheme.dll BASE=0x7D030000
EXPORTS
CloseThemeData
DrawThemeBackground
DrawThemeBackgroundEx
DrawThemeEdge
DrawThemeIcon
DrawThemeParentBackground
DrawThemeText
EnableThemeDialogTexture
EnableTheming
GetCurrentThemeName
GetThemeAppProperties
GetThemeBackgroundContentRect
GetThemeBackgroundExtent
GetThemeBackgroundRegion
GetThemeBool
GetThemeColor
GetThemeDocumentationProperty
GetThemeEnumValue
GetThemeFilename
GetThemeFont
GetThemeInt
GetThemeIntList
GetThemeMargins
GetThemeMetric
GetThemePartSize
GetThemePosition
GetThemePropertyOrigin
GetThemeRect
GetThemeString
GetThemeSysBool
GetThemeSysColor
GetThemeSysColorBrush
GetThemeSysFont
GetThemeSysInt
GetThemeSysSize
GetThemeSysString
GetThemeTextExtent
GetThemeTextMetrics
GetWindowTheme
HitTestThemeBackground
IsAppThemed
IsThemeActive
IsThemeBackgroundPartiallyTransparent
IsThemeDialogTextureEnabled
IsThemePartDefined
OpenThemeData
SetThemeAppProperties
SetWindowTheme

View File

@ -0,0 +1,43 @@
# Makefile for GNU C Compiler (GCC)
CC = gcc
CXX = g++
RCC = windres
OBJ = wtsapi32.o
RES =
LIBS =
DEF = wtsapi32.def
LDFLAGS = -s -shared -Wl,--kill-at
BIN = ..\wtsapi32.dll
CFLAGS = -Os -Wall
CXXFLAGS = $(CFLAGS)
.SUFFIXES: .rc
all : $(BIN)
.PHONY : clean
clean :
-@if exist *.o del *.o
-@if exist *.po del *.po
-@if exist *.a del *.a
realclean : clean
-@if exist $(BIN) del $(BIN)
$(BIN) : $(OBJ) $(RES)
$(CXX) $(LDFLAGS) -o $(BIN) $(OBJ) $(RES) $(LIBS) $(DEF)
.c.o :
$(CC) $(CFLAGS) -c -MMD -MF $*.po -o $@ $<
.cpp.o :
$(CXX) $(CXXFLAGS) -c -MMD -MF $*.po -o $@ $<
.rc.o :
$(RCC) $< $@
.def.a :
dlltool --def $< -l $@
-include $(OBJ:.o=.po)

View File

@ -0,0 +1,33 @@
# Makefile for Microsoft Visual C++ Compiler (MSVC)
OBJ = wtsapi32.obj
RES =
DEF = /DEF:wtsapi32.def
BIN = ..\wtsapi32.dll
LIBS = -nodefaultlib kernel32.lib gdi32.lib
LDFLAGS = /DLL /OPT:NOWIN98 /ENTRY:DllMain@12
CFLAGS = /W3 /O2 /Oi /FD
CXXFLAGS = $(CFLAGS)
all : $(BIN)
-@if exist $(BIN:.dll=.exp) del $(BIN:.dll=.exp)
-@if exist $(BIN:.dll=.lib) del $(BIN:.dll=.lib)
.PHONY : clean
clean :
-@if exist *.obj del *.obj
-@if exist *.idb del *.idb
-@if exist *.res del *.res
realclean : clean
-@if exist $(BIN) del $(BIN)
$(BIN) : $(OBJ) $(RES)
link /nologo $(LDFLAGS) $(DEF) /OUT:$(BIN) $(LIBS) $(OBJ) $(RES)
.c.obj :
cl /nologo $(CFLAGS) /c /Fo$@ $<
.cpp.obj :
cl /nologo $(CXXFLAGS) /c /Fo$@ $<

View File

@ -0,0 +1,343 @@
/* Copyright 2007 Xeno86
* Copyright 2005 Ulrich Czekalla
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
//#include "config.h"
#include <stdarg.h>
#include <stdlib.h>
#include <windows.h>
/*#include "windef.h"
#include "winbase.h"*/
#include "wtsapi32.h"
//#include "wine/debug.h"
#include <stdio.h>
#ifdef _MSC_VER
#define TRACE()
#define FIXME()
#else
#define TRACE(x,args...) debug_output(__func__,x,args)
#define FIXME(x,args...) TRACE("FIXME: "x,args)
#endif
//WINE_DEFAULT_DEBUG_CHANNEL(wtsapi);
static const char* debugstr_a(const char* a)
{
return a;
}
static const char* debugstr_w(const wchar_t* w)
{
static char a[256];
WideCharToMultiByte(CP_ACP, 0, w, -1, a, sizeof(a), NULL, NULL);
return a;
}
static void debug_output(const char* func, const char* fmt, ...)
{
va_list args;
char buf[200];
va_start(args, fmt);
strcpy(buf, func);
strcat(buf, ": ");
vsprintf(buf + strlen(buf), fmt, args);
va_end(args);
OutputDebugStringA(buf);
}
static HMODULE WTSAPI32_hModule = 0;
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("%p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
{
OSVERSIONINFO osv;
osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osv);
if (osv.dwMajorVersion < 5)
return FALSE;
DisableThreadLibraryCalls(hinstDLL);
WTSAPI32_hModule = hinstDLL;
break;
}
case DLL_PROCESS_DETACH:
{
break;
}
}
return TRUE;
}
/************************************************************
* WTSCloseServer (WTSAPI32.@)
*/
void WINAPI WTSCloseServer(HANDLE hServer)
{
FIXME("Stub %p\n", hServer);
}
/************************************************************
* WTSDisconnectSession (WTSAPI32.@)
*/
BOOL WINAPI WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait)
{
FIXME("Stub %p 0x%08lx %d\n", hServer, SessionId, bWait);
return TRUE;
}
/************************************************************
* WTSEnumerateProcessesA (WTSAPI32.@)
*/
BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version,
PWTS_PROCESS_INFOA* ppProcessInfo, DWORD* pCount)
{
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
ppProcessInfo, pCount);
if (!ppProcessInfo || !pCount) return FALSE;
*pCount = 0;
*ppProcessInfo = NULL;
return TRUE;
}
/************************************************************
* WTSEnumerateProcessesW (WTSAPI32.@)
*/
BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version,
PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
{
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
ppProcessInfo, pCount);
if (!ppProcessInfo || !pCount) return FALSE;
*pCount = 0;
*ppProcessInfo = NULL;
return TRUE;
}
/************************************************************
* WTSEnumerateServersA (WTSAPI32.@)
*/
BOOL WINAPI WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version,
PWTS_SERVER_INFOA* ppServerInfo, DWORD* pCount)
{
FIXME("Stub %s 0x%08lx 0x%08lx %p %p\n", debugstr_a(pDomainName), Reserved, Version,
ppServerInfo, pCount);
if (!ppServerInfo || !pCount) return FALSE;
*pCount = 0;
*ppServerInfo = NULL;
return TRUE;
}
/************************************************************
* WTSEnumerateServersW (WTSAPI32.@)
*/
BOOL WINAPI WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version,
PWTS_SERVER_INFOW* ppServerInfo, DWORD* pCount)
{
FIXME("Stub %s 0x%08lx 0x%08lx %p %p\n", debugstr_w(pDomainName), Reserved, Version,
ppServerInfo, pCount);
if (!ppServerInfo || !pCount) return FALSE;
*pCount = 0;
*ppServerInfo = NULL;
return TRUE;
}
/************************************************************
* WTSEnumerateEnumerateSessionsA (WTSAPI32.@)
*/
BOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version,
PWTS_SESSION_INFOA* ppSessionInfo, DWORD* pCount)
{
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
ppSessionInfo, pCount);
if (!ppSessionInfo || !pCount) return FALSE;
*pCount = 0;
*ppSessionInfo = NULL;
return TRUE;
}
/************************************************************
* WTSEnumerateEnumerateSessionsW (WTSAPI32.@)
*/
BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version,
PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount)
{
FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
ppSessionInfo, pCount);
if (!ppSessionInfo || !pCount) return FALSE;
*pCount = 0;
*ppSessionInfo = NULL;
return TRUE;
}
/************************************************************
* WTSFreeMemory (WTSAPI32.@)
*/
void WINAPI WTSFreeMemory(PVOID pMemory)
{
FIXME("Stub %p\n", pMemory);
return;
}
/************************************************************
* WTSOpenServerA (WTSAPI32.@)
*/
HANDLE WINAPI WTSOpenServerA(LPSTR pServerName)
{
FIXME("(%s) stub\n", debugstr_a(pServerName));
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return NULL;
}
/************************************************************
* WTSOpenServerW (WTSAPI32.@)
*/
HANDLE WINAPI WTSOpenServerW(LPWSTR pServerName)
{
FIXME("(%s) stub\n", debugstr_w(pServerName));
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return NULL;
}
/************************************************************
* WTSQuerySessionInformationA (WTSAPI32.@)
*/
BOOL WINAPI WTSQuerySessionInformationA(
HANDLE hServer,
DWORD SessionId,
WTS_INFO_CLASS WTSInfoClass,
LPSTR* Buffer,
DWORD* BytesReturned)
{
/* FIXME: Forward request to winsta.dll::WinStationQueryInformationA */
FIXME("Stub %p 0x%08lx %d %p %p\n", hServer, SessionId, WTSInfoClass,
Buffer, BytesReturned);
return FALSE;
}
/************************************************************
* WTSQuerySessionInformationW (WTSAPI32.@)
*/
BOOL WINAPI WTSQuerySessionInformationW(
HANDLE hServer,
DWORD SessionId,
WTS_INFO_CLASS WTSInfoClass,
LPWSTR* Buffer,
DWORD* BytesReturned)
{
/* FIXME: Forward request to winsta.dll::WinStationQueryInformationW */
FIXME("Stub %p 0x%08lx %d %p %p\n", hServer, SessionId, WTSInfoClass,
Buffer, BytesReturned);
return FALSE;
}
/************************************************************
* WTSQueryUserConfigA (WTSAPI32.@)
*/
BOOL WINAPI WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName,
WTS_CONFIG_CLASS WTSConfigClass, LPSTR* ppBuffer, DWORD* pBytesReturned)
{
FIXME("Stub %s %s 0x%08lx %p %p\n", debugstr_a(pServerName), debugstr_a(pUserName),
WTSConfigClass, ppBuffer, pBytesReturned);
return FALSE;
}
/************************************************************
* WTSQueryUserConfigW (WTSAPI32.@)
*/
BOOL WINAPI WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName,
WTS_CONFIG_CLASS WTSConfigClass, LPWSTR* ppBuffer, DWORD* pBytesReturned)
{
FIXME("Stub %s %s 0x%08lx %p %p\n", debugstr_w(pServerName), debugstr_w(pUserName),
WTSConfigClass, ppBuffer, pBytesReturned);
return FALSE;
}
/************************************************************
* WTSQueryUserToken (WTSAPI32.@)
*/
BOOL WINAPI WTSQueryUserToken(ULONG SessionId, PHANDLE phToken)
{
SetLastError(ERROR_NO_TOKEN);
return FALSE;
}
/************************************************************
* WTSRegisterSessionNotification (WTSAPI32.@)
*/
BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags)
{
FIXME("Stub %p 0x%08x\n", hWnd, dwFlags);
return TRUE;
}
/************************************************************
* WTSTerminateProcess (WTSAPI32.@)
*/
BOOL WINAPI WTSTerminateProcess(HANDLE hServer, DWORD ProcessId, DWORD ExitCode)
{
FIXME("Stub %p 0x%08x 0x%08x\n", hServer, ProcessId, ExitCode);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/************************************************************
* WTSUnRegisterSessionNotification (WTSAPI32.@)
*/
BOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd)
{
FIXME("Stub %p\n", hWnd);
return TRUE;
}
/************************************************************
* WTSWaitSystemEvent (WTSAPI32.@)
*/
BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD Mask, DWORD* Flags)
{
/* FIXME: Forward request to winsta.dll::WinStationWaitSystemEvent */
FIXME("Stub %p 0x%08lx %p\n", hServer, Mask, Flags);
return FALSE;
}

View File

@ -0,0 +1,22 @@
LIBRARY wtsapi32.dll BASE=0x7D040000
EXPORTS
WTSCloseServer
WTSDisconnectSession
WTSEnumerateProcessesA
WTSEnumerateProcessesW
WTSEnumerateServersA
WTSEnumerateServersW
WTSEnumerateSessionsA
WTSEnumerateSessionsW
WTSFreeMemory
WTSOpenServerA
WTSOpenServerW
WTSQuerySessionInformationA
WTSQuerySessionInformationW
WTSQueryUserConfigA
WTSQueryUserConfigW
WTSQueryUserToken
WTSRegisterSessionNotification
WTSTerminateProcess
WTSUnRegisterSessionNotification
WTSWaitSystemEvent

View File

@ -0,0 +1,165 @@
/*
* Copyright 2005 Ulrich Czekalla (For CodeWeavers)
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_WTSAPI32_H
#define __WINE_WTSAPI32_H
#define DECL_WINELIB_TYPE_AW(x)
#ifdef __cplusplus
extern "C" {
#endif
typedef enum tagWTS_INFO_CLASS
{
WTSInitialProgram,
WTSApplicationName,
WTSWorkingDirectory,
WTSOEMId,
WTSSessionId,
WTSUserName,
WTSWinStationName,
WTSDomainName,
WTSConnectState,
WTSClientBuildNumber,
WTSClientName,
WTSClientDirectory,
WTSClientProductId,
WTSClientHardwareId,
WTSClientAddress,
WTSClientDisplay,
WTSClientProtocolType,
} WTS_INFO_CLASS;
typedef enum _WTS_CONNECTSTATE_CLASS
{
WTSActive,
WTSConnected,
WTSConnectQuery,
WTSShadow,
WTSDisconnected,
WTSIdle,
WTSListen,
WTSReset,
WTSDown,
WTSInit
} WTS_CONNECTSTATE_CLASS;
typedef enum _WTS_CONFIG_CLASS
{
WTSUserConfigInitialProgram,
WTSUserConfigWorkingDirectory,
WTSUserConfigInheritInitialProgram,
WTSUserConfigAllowLogonTerminalServer,
WTSUserConfigTimeoutSettingsConnections,
WTSUserConfigTimeoutSettingsDisconnections,
WTSUserConfigTimeoutSettingsIdle,
WTSUserConfigDeviceClientDrives,
WTSUserConfigDeviceClientPrinters,
WTSUserConfigDeviceClientDefaultPrinter,
WTSUserConfigBrokenTimeoutSettings,
WTSUserConfigModemCallbackSettings,
WTSUserConfigModemCallbackPhoneNumber,
WTSUserConfigShadowSettings,
WTSUserConfigTerminalServerProfilePath,
WTSUserConfigTerminalServerHomeDirectory,
WTSUserConfigfTerminalServerRemoteHomeDir
} WTS_CONFIG_CLASS;
typedef struct _WTS_PROCESS_INFOA
{
DWORD SessionId;
DWORD ProcessId;
LPSTR pProcessName;
PSID pUserSid;
} WTS_PROCESS_INFOA, *PWTS_PROCESS_INFOA;
typedef struct _WTS_PROCESS_INFOW
{
DWORD SessionId;
DWORD ProcessId;
LPWSTR pProcessName;
PSID pUserSid;
} WTS_PROCESS_INFOW, *PWTS_PROCESS_INFOW;
DECL_WINELIB_TYPE_AW(WTS_PROCESS_INFO)
DECL_WINELIB_TYPE_AW(PWTS_PROCESS_INFO)
typedef struct _WTS_SESSION_INFOA
{
DWORD SessionId;
LPSTR pWinStationName;
WTS_CONNECTSTATE_CLASS State;
} WTS_SESSION_INFOA, *PWTS_SESSION_INFOA;
typedef struct _WTS_SESSION_INFOW
{
DWORD SessionId;
LPWSTR pWinStationName;
WTS_CONNECTSTATE_CLASS State;
} WTS_SESSION_INFOW, *PWTS_SESSION_INFOW;
DECL_WINELIB_TYPE_AW(WTS_SESSION_INFO)
DECL_WINELIB_TYPE_AW(PWTS_SESSION_INFO)
typedef struct _WTS_SERVER_INFOA
{
LPSTR pServerName;
} WTS_SERVER_INFOA, *PWTS_SERVER_INFOA;
typedef struct _WTS_SERVER_INFOW
{
LPWSTR pServerName;
} WTS_SERVER_INFOW, *PWTS_SERVER_INFOW;
DECL_WINELIB_TYPE_AW(WTS_SERVER_INFO)
DECL_WINELIB_TYPE_AW(PWTS_SERVER_INFO)
void WINAPI WTSCloseServer(HANDLE);
BOOL WINAPI WTSDisconnectSession(HANDLE, DWORD, BOOL);
BOOL WINAPI WTSEnumerateProcessesA(HANDLE, DWORD, DWORD, PWTS_PROCESS_INFOA *, DWORD *);
BOOL WINAPI WTSEnumerateProcessesW(HANDLE, DWORD, DWORD, PWTS_PROCESS_INFOW *, DWORD *);
#define WTSEnumerateProcesses WINELIB_NAME_AW(WTSEnumerateProcesses)
BOOL WINAPI WTSEnumerateServersA( LPSTR, DWORD, DWORD, PWTS_SERVER_INFOA*, DWORD*);
BOOL WINAPI WTSEnumerateServersW( LPWSTR, DWORD, DWORD, PWTS_SERVER_INFOW*, DWORD*);
#define WTSEnumerateServers WINELIB_NAME_AW(WTSEnumerateServers)
BOOL WINAPI WTSEnumerateSessionsA(HANDLE, DWORD, DWORD, PWTS_SESSION_INFOA *, DWORD *);
BOOL WINAPI WTSEnumerateSessionsW(HANDLE, DWORD, DWORD, PWTS_SESSION_INFOW *, DWORD *);
#define WTSEnumerateSessions WINELIB_NAME_AW(WTSEnumerateSessions)
void WINAPI WTSFreeMemory(PVOID);
HANDLE WINAPI WTSOpenServerA(LPSTR);
HANDLE WINAPI WTSOpenServerW(LPWSTR);
#define WTSOpenServer WINELIB_NAME_AW(WTSOpenServer)
BOOL WINAPI WTSQuerySessionInformationA(HANDLE, DWORD, WTS_INFO_CLASS, LPSTR *, DWORD *);
BOOL WINAPI WTSQuerySessionInformationW(HANDLE, DWORD, WTS_INFO_CLASS, LPWSTR *, DWORD *);
#define WTSQuerySessionInformation WINELIB_NAME_AW(WTSQuerySessionInformation)
BOOL WINAPI WTSQueryUserConfigA(LPSTR,LPSTR,WTS_CONFIG_CLASS,LPSTR*,DWORD*);
BOOL WINAPI WTSQueryUserConfigW(LPWSTR,LPWSTR,WTS_CONFIG_CLASS,LPWSTR*,DWORD*);
#define WTSQueryUserConfig WINELIB_NAME_AW(WTSQueryUserConfig)
BOOL WINAPI WTSQueryUserToken(ULONG, PHANDLE);
BOOL WINAPI WTSRegisterSessionNotification(HWND, DWORD);
BOOL WINAPI WTSTerminateProcess(HANDLE, DWORD, DWORD);
BOOL WINAPI WTSUnRegisterSessionNotification(HWND);
BOOL WINAPI WTSWaitSystemEvent(HANDLE, DWORD, DWORD*);
#ifdef __cplusplus
}
#endif
#endif