Revert cards.dll and crypt32.dll autowinesync.

svn path=/trunk/; revision=22841
This commit is contained in:
Aleksey Bragin 2006-07-04 19:14:19 +00:00
parent e27f4b8e40
commit 04bed5affc
76 changed files with 334 additions and 20959 deletions

View file

@ -1,7 +1,7 @@
/*
* Cards dll implementation
* ReactOS Cards
*
* Copyright (C) 2004 Sami Nopanen
* Copyright (C) 2003 Filip Navara <xnavara@volny.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -18,286 +18,224 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "windows.h"
#include "cards.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(cards);
HBITMAP g_CardBitmaps[MAX_CARD_BITMAPS];
HINSTANCE g_hModule = 0;
void WINAPI cdtTerm(void);
static HINSTANCE hInst;
static int cardWidth;
static int cardHeight;
static HBITMAP cardBitmaps[CARD_MAX + 1];
/***********************************************************************
* Initializes the cards.dll library. Loads the card bitmaps from the
* resources, and initializes the card size variables.
/*
* Redundant function from 16-bit Windows time
*/
BOOL WINAPI cdtInit(int *width, int *height)
BOOL WINAPI WEP(DWORD Unknown)
{
BITMAP bm;
int i;
TRACE("(%p, %p)\n", width, height);
for(i = 0; i <= CARD_MAX; i++)
cardBitmaps[i] = 0;
for(i = 0; i <= CARD_MAX; i++)
{
cardBitmaps[i] = LoadBitmapA(hInst, MAKEINTRESOURCEA(i));
if(cardBitmaps[i] == 0)
{
cdtTerm();
return FALSE;
}
}
GetObjectA(cardBitmaps[0], sizeof(BITMAP), &bm);
*width = cardWidth = bm.bmWidth;
*height = cardHeight = bm.bmHeight;
return TRUE;
}
static DWORD do_blt(HDC hdc, int x, int y, int dx, int dy, HDC hMemoryDC, DWORD rasterOp )
{
if((cardWidth == dx) && (cardHeight == dy))
return BitBlt(hdc, x, y, cardWidth, cardHeight, hMemoryDC, 0, 0, rasterOp);
return StretchBlt(hdc, x, y, dx, dy, hMemoryDC, 0, 0, cardWidth, cardHeight, rasterOp);
/*
* Initialize card library and return cards width and height
*/
BOOL WINAPI cdtInit(INT *Width, INT *Height)
{
DWORD dwIndex;
/* Report card width and height to user */
*Width = CARD_WIDTH;
*Height = CARD_HEIGHT;
/* Load images */
for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; ++dwIndex)
g_CardBitmaps[dwIndex] =
(HBITMAP)LoadBitmapA(g_hModule, MAKEINTRESOURCEA(dwIndex + 1));
return TRUE;
}
/***********************************************************************
* Draw a card. Unlike cdtDrawCard, this version allows you to stretch
* card bitmaps to the size you specify (dx, dy). See cdtDraw for info
* on card, mode and color parameters.
/*
* Terminate card library
*/
BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int mode, DWORD color)
VOID WINAPI cdtTerm(VOID)
{
HDC hMemoryDC;
HBITMAP hCardBitmap;
HGDIOBJ result;
DWORD rasterOp = SRCCOPY;
BOOL roundCornersFlag;
BOOL eraseFlag = FALSE;
BOOL drawFlag = TRUE;
DWORD dwIndex;
TRACE("(%p, %d, %d, %d, %d, %d, %d, %ld)\n", hdc, x, y, dx, dy, card, mode, color);
/* Unload images */
for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; dwIndex++)
DeleteObject(g_CardBitmaps[dwIndex]);
}
roundCornersFlag = !(mode & MODEFLAG_DONT_ROUND_CORNERS) &&
(dx == cardWidth) && (dy == cardHeight);
mode &= ~MODEFLAG_DONT_ROUND_CORNERS;
/*
* Render card with no stretching
*/
BOOL WINAPI cdtDraw(HDC hdc, INT x, INT y, INT card, INT type, COLORREF color)
{
return cdtDrawExt(hdc, x, y, CARD_WIDTH, CARD_HEIGHT, card, type, color);
}
if((card < 0) || (card > CARD_MAX))
/*
* internal
*/
static __inline VOID BltCard(HDC hdc, INT x, INT y, INT dx, INT dy, HDC hdcCard, DWORD dwRasterOp, BOOL bStretch)
{
if (bStretch)
{
FIXME("Unexpected card: %d\n", card);
return FALSE;
}
if((mode < MODE_FACEUP) || (mode > MODE_DECKO))
StretchBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, CARD_WIDTH, CARD_HEIGHT, dwRasterOp);
} else
{
FIXME("Unexpected mode: %d\n", mode);
return FALSE;
}
switch(mode)
{
case MODE_FACEUP:
break;
case MODE_FACEDOWN:
break;
case MODE_HILITE:
rasterOp = NOTSRCCOPY;
break;
case MODE_GHOST:
card = CARD_FREE_MASK;
eraseFlag = TRUE;
rasterOp = SRCAND;
break;
case MODE_REMOVE:
eraseFlag = TRUE;
drawFlag = FALSE;
break;
case MODE_INVISIBLEGHOST:
card = CARD_FREE_MASK;
rasterOp = SRCAND;
break;
case MODE_DECKX:
card = CARD_BACK_THE_X;
break;
case MODE_DECKO:
card = CARD_BACK_THE_O;
break;
}
hMemoryDC = CreateCompatibleDC(hdc);
if(hMemoryDC == 0)
return FALSE;
if(eraseFlag)
{
HBRUSH hBrush;
RECT rect;
hBrush = CreateSolidBrush(color);
rect.left = x;
rect.top = y;
rect.right = x + cardWidth - 1;
rect.bottom = y + cardHeight - 1;
FillRect(hdc, &rect, hBrush);
}
if(drawFlag)
{
hCardBitmap = cardBitmaps[card];
if(hCardBitmap == 0)
return FALSE;
result = SelectObject(hMemoryDC, hCardBitmap);
if((result == 0) || (result == HGDI_ERROR))
BitBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, dwRasterOp);
/*
* This is need when using Microsoft images, because they use two-color red/white images for
* red cards and thus needs fix-up of the edge to black color.
*/
#if 0
if (ISREDCARD(card))
{
DeleteDC(hMemoryDC);
return FALSE;
PatBlt(hdc, x, y + 2, 1, dy - 4, BLACKNESS);
PatBlt(hdc, x + dx - 1, y + 2, 1, dy - 4, BLACKNESS);
PatBlt(hdc, x + 2, y, dx - 4, 1, BLACKNESS);
PatBlt(hdc, x + 2, y + dy - 1, dx - 4, 1, BLACKNESS);
SetPixel(hdc, x + 1, y + 1, 0);
SetPixel(hdc, x + dx - 2, y + 1, 0);
SetPixel(hdc, x + 1, y + dy - 2, 0);
SetPixel(hdc, x + dx - 2, y + dy - 2, 0);
}
#endif
}
}
SetBkColor(hdc, color);
/*
* Render card
*
* Parameters:
* hdc - Handle of destination device context
* x - Position left
* y - Position right
* dx - Destination width
* dy - Destination height
* card - Image id (meaning depend on type)
* type - One of edt* constants
* color - Background color (?)
*/
BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type, COLORREF color)
{
HDC hdcCard;
DWORD dwRasterOp = SRCCOPY, OldBkColor;
BOOL bSaveEdges = TRUE;
BOOL bStretch = FALSE;
if(roundCornersFlag)
{
COLORREF savedPixels[12];
savedPixels[0] = GetPixel(hdc, x, y);
savedPixels[1] = GetPixel(hdc, x + 1, y);
savedPixels[2] = GetPixel(hdc, x, y + 1);
savedPixels[3] = GetPixel(hdc, x + dx - 1, y);
savedPixels[4] = GetPixel(hdc, x + dx - 2, y);
savedPixels[5] = GetPixel(hdc, x + dx - 1, y + 1);
savedPixels[6] = GetPixel(hdc, x, y + dy - 1);
savedPixels[7] = GetPixel(hdc, x + 1, y + dy - 1);
savedPixels[8] = GetPixel(hdc, x, y + dy - 2);
savedPixels[9] = GetPixel(hdc, x + dx - 1, y + dy - 1);
savedPixels[10] = GetPixel(hdc, x + dx - 2, y + dy - 1);
savedPixels[11] = GetPixel(hdc, x + dx - 1, y + dy - 2);
do_blt(hdc, x, y, dx, dy, hMemoryDC, rasterOp);
SetPixel(hdc, x, y, savedPixels[0]);
SetPixel(hdc, x + 1, y, savedPixels[1]);
SetPixel(hdc, x, y + 1, savedPixels[2]);
SetPixel(hdc, x + dx - 1, y, savedPixels[3]);
SetPixel(hdc, x + dx - 2, y, savedPixels[4]);
SetPixel(hdc, x + dx - 1, y + 1, savedPixels[5]);
SetPixel(hdc, x, y + dy - 1, savedPixels[6]);
SetPixel(hdc, x + 1, y + dy - 1, savedPixels[7]);
SetPixel(hdc, x, y + dy - 2, savedPixels[8]);
SetPixel(hdc, x + dx - 1, y + dy - 1, savedPixels[9]);
SetPixel(hdc, x + dx - 2, y + dy - 1, savedPixels[10]);
SetPixel(hdc, x + dx - 1, y + dy - 2, savedPixels[11]);
}
else
do_blt(hdc, x, y, dx, dy, hMemoryDC, rasterOp);
if (type & ectSAVEEDGESMASK)
{
type &= ~ectSAVEEDGESMASK;
bSaveEdges = FALSE;
}
DeleteDC(hMemoryDC);
if (dx != CARD_WIDTH || dy != CARD_HEIGHT)
{
bStretch = TRUE;
bSaveEdges = FALSE;
}
switch (type)
{
case ectINVERTED:
dwRasterOp = NOTSRCCOPY;
case ectFACES:
card = (card % 4) * 13 + (card / 4);
break;
case ectBACKS:
--card;
break;
case ectEMPTYNOBG:
dwRasterOp = SRCAND;
case ectEMPTY:
card = 52;
break;
case ectERASE:
break;
case ectREDX:
card = 66;
break;
case ectGREENO:
card = 67;
break;
default:
return FALSE;
}
if (type == ectEMPTY || type == ectERASE)
{
POINT pPoint;
HBRUSH hBrush;
hBrush = CreateSolidBrush(color);
GetDCOrgEx(hdc, &pPoint);
SetBrushOrgEx(hdc, pPoint.x, pPoint.y, 0);
SelectObject(hdc, hBrush);
PatBlt(hdc, x, y, dx, dy, PATCOPY);
}
if (type != ectERASE)
{
hdcCard = CreateCompatibleDC(hdc);
SelectObject(hdcCard, g_CardBitmaps[card]);
OldBkColor = SetBkColor(hdc, (type == ectFACES) ? 0xFFFFFF : color);
if (bSaveEdges)
{
COLORREF SavedPixels[12];
SavedPixels[0] = GetPixel(hdc, x, y);
SavedPixels[1] = GetPixel(hdc, x + 1, y);
SavedPixels[2] = GetPixel(hdc, x, y + 1);
SavedPixels[3] = GetPixel(hdc, x + dx - 1, y);
SavedPixels[4] = GetPixel(hdc, x + dx - 2, y);
SavedPixels[5] = GetPixel(hdc, x + dx - 1, y + 1);
SavedPixels[6] = GetPixel(hdc, x, y + dy - 1);
SavedPixels[7] = GetPixel(hdc, x + 1, y + dy - 1);
SavedPixels[8] = GetPixel(hdc, x, y + dy - 2);
SavedPixels[9] = GetPixel(hdc, x + dx - 1, y + dy - 1);
SavedPixels[10] = GetPixel(hdc, x + dx - 2, y + dy - 1);
SavedPixels[11] = GetPixel(hdc, x + dx - 1, y + dy - 2);
BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch);
SetPixel(hdc, x, y, SavedPixels[0]);
SetPixel(hdc, x + 1, y, SavedPixels[1]);
SetPixel(hdc, x, y + 1, SavedPixels[2]);
SetPixel(hdc, x + dx - 1, y, SavedPixels[3]);
SetPixel(hdc, x + dx - 2, y, SavedPixels[4]);
SetPixel(hdc, x + dx - 1, y + 1, SavedPixels[5]);
SetPixel(hdc, x, y + dy - 1, SavedPixels[6]);
SetPixel(hdc, x + 1, y + dy - 1, SavedPixels[7]);
SetPixel(hdc, x, y + dy - 2, SavedPixels[8]);
SetPixel(hdc, x + dx - 1, y + dy - 1, SavedPixels[9]);
SetPixel(hdc, x + dx - 2, y + dy - 1, SavedPixels[10]);
SetPixel(hdc, x + dx - 1, y + dy - 2, SavedPixels[11]);
}
else
{
BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch);
}
SetBkColor(hdc, OldBkColor);
DeleteDC(hdcCard);
}
return TRUE;
}
/***********************************************************************
* Draws a card at position x, y in its default size (as returned by
* cdtInit.
* cdtAnimate (CARDS.@)
*
* Mode controls how the card gets drawn:
* MODE_FACEUP ; draw card facing up
* MODE_FACEDOWN ; draw card facing down
* MODE_HILITE ; draw face up, with NOTSRCCOPY
* MODE_GHOST ; draw 'ghost' card
* MODE_REMOVE ; draw with background color
* MODE_INVISIBLEGHOST ; draw 'ghost' card, without clearing background
* MODE_DECKX ; draw X
* MODE_DECKO ; draw O
*
* The card parameter defines the card graphic to be drawn. If we are
* drawing fronts of cards, card should have a value from 0 through 51
* to represent the card face. If we are drawing card backs, 53 through
* 68 represent different card backs.
*
* When drawing card faces, two lowest bits represent the card suit
* (clubs, diamonds, hearts, spades), and the bits above that define the
* card value (ace, 2, ..., king). That is,
* card = face * 4 + suit.
*
* Color parameter defines the background color, used when drawing some
* card backs.
*/
BOOL WINAPI cdtDraw(HDC hdc, int x, int y, int card, int mode, DWORD color)
{
TRACE("(%p, %d, %d, %d, %d, %ld)\n", hdc, x, y, card, mode, color);
return cdtDrawExt(hdc, x, y, cardWidth, cardHeight, card, mode, color);
}
/***********************************************************************
* Animates the card backs, e.g. blinking lights on the robot, the sun
* donning sunglasses, bats flying across the caste, etc.. Works only
* for cards of normal size (as drawn with cdtDraw). To draw frames of
* the card back animation, start with frame = 0, and increment the
* frame by one, until cdtAnimate returns FALSE (to indicate that we
* have gone through all frames of animation).
* Animate card background, we don't use it
*/
BOOL WINAPI cdtAnimate(HDC hdc, int cardback, int x, int y, int frame)
{
TRACE("(%p, %d, %d, %d, %d)\n", hdc, cardback, x, y, frame);
FIXME("Implement me.\n");
return FALSE;
return TRUE;
}
/***********************************************************************
* Frees resources reserved by cdtInitialize.
*/
void WINAPI cdtTerm()
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
int i;
if (fdwReason == DLL_PROCESS_ATTACH)
g_hModule = hinstDLL;
TRACE("()\n");
for(i = 0; i <= CARD_MAX; i++)
{
if(cardBitmaps[i] != 0)
DeleteObject(cardBitmaps[i]);
cardBitmaps[i] = 0;
}
}
/***********************************************************************
* DllMain.
*/
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
hInst = inst;
DisableThreadLibraryCalls( inst );
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

View file

@ -0,0 +1,8 @@
LIBRARY cards.dll
EXPORTS
WEP@4
cdtAnimate@20
cdtDraw@24
cdtDrawExt@32
cdtInit@8
cdtTerm@0

View file

@ -1,7 +1,7 @@
/*
* Cards dll definitions
* ReactOS Cards
*
* Copyright (C) 2004 Sami Nopanen
* Copyright (C) 2003 Filip Navara <xnavara@volny.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -18,54 +18,44 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __CARDS_H__
#define __CARDS_H__
#ifndef _CARDS_H
#define _CARDS_H
/* Card suits */
#define CARD_SUIT_CLUBS 0
#define CARD_SUIT_DIAMONDS 1
#define CARD_SUIT_HEARTS 2
#define CARD_SUIT_SPADES 3
/*
* 52 card faces +
* 12 card backs +
* X Sign +
* O Sign +
* FreeCard +
* Joker
*/
#define MAX_CARD_BITMAPS 68
#define ectFACES 0
#define ectBACKS 1
#define ectINVERTED 2
#define ectEMPTY 3
#define ectERASE 4
#define ectEMPTYNOBG 5
#define ectREDX 6
#define ectGREENO 7
#define ectSAVEEDGESMASK 0x80000000
/* 0-51 = normal 52 cards of deck */
/* 52 = ghost card mask */
/* 53-68 = card backs */
#define CARD_FREE_MASK 52
#define CARD_BACK_CROSSHATCH 53
#define CARD_BACK_WEAVE1 54
#define CARD_BACK_WEAVE2 55
#define CARD_BACK_ROBOT 56
#define CARD_BACK_FLOWERS 57
#define CARD_BACK_VINE1 58
#define CARD_BACK_VINE2 59
#define CARD_BACK_FISH1 60
#define CARD_BACK_FISH2 61
#define CARD_BACK_SHELLS 62
#define CARD_BACK_CASTLE 63
#define CARD_BACK_ISLAND 64
#define CARD_BACK_CARDHAND 65
#define CARD_BACK_UNUSED 66
#define CARD_BACK_THE_X 67
#define CARD_BACK_THE_O 68
/* Microsoft card dimensions */
/*
#define CARD_WIDTH 71
#define CARD_HEIGHT 96
*/
/* Oxymoron's card dimensions */
#define CARD_WIDTH 73
#define CARD_HEIGHT 97
#define CARD_MAX 68
#define ISREDCARD(x) (x >= 13 && x <= 39)
/* Drawing modes */
#define MODE_FACEUP 0
#define MODE_FACEDOWN 1
#define MODE_HILITE 2
#define MODE_GHOST 3
#define MODE_REMOVE 4
#define MODE_INVISIBLEGHOST 5
#define MODE_DECKX 6
#define MODE_DECKO 7
BOOL WINAPI cdtInit(int *width, int *height);
BOOL WINAPI cdtDraw(HDC hdc, int x, int y, int card, int type, DWORD color);
BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int suit, DWORD color);
BOOL WINAPI cdtAnimate(HDC hdc, int cardback, int x, int y, int frame);
void WINAPI cdtTerm(void);
#define MODEFLAG_DONT_ROUND_CORNERS 0x80000000
/* As defined by CARD_SUIT_* */
#define SUIT_FROM_CARD(card) (card & 3)
/* 0 = ace, ..., 12 = king */
#define FACE_FROM_CARD(card) (card >> 2)
#endif
#endif /* _CARDS_H */

View file

@ -1,22 +1,13 @@
<module name="cards" type="win32dll" baseaddress="${BASEADDRESS_CARDS}" installbase="system32" installname="cards.dll" allowwarnings="true">
<importlibrary definition="cards.spec.def" />
<module name="cards" type="win32dll" baseaddress="${BASEADDRESS_CARDS}" installbase="system32" installname="cards.dll">
<importlibrary definition="cards.def" />
<include base="cards">.</include>
<include base="ReactOS">include/reactos/wine</include>
<define name="__REACTOS__" />
<define name="__WINESRC__" />
<define name="UNICODE" />
<define name="_UNICODE" />
<define name="__USE_W32API" />
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="WINVER">0x501</define>
<library>wine</library>
<library>user32</library>
<library>gdi32</library>
<library>ntdll</library>
<library>kernel32</library>
<library>ntdll</library>
<library>gdi32</library>
<library>user32</library>
<file>cards.c</file>
<library>ntdll</library>
<file>cards.rc</file>
<library>ntdll</library>
<file>version.rc</file>
<file>cards.spec</file>
</module>

File diff suppressed because it is too large Load diff

View file

@ -1,5 +0,0 @@
@ stdcall cdtAnimate(long long long long long)
@ stdcall cdtDraw(long long long long long long)
@ stdcall cdtDrawExt(long long long long long long long long)
@ stdcall cdtInit(ptr ptr)
@ stdcall cdtTerm()

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -1,28 +0,0 @@
/*
* Cards dll version resources
*
* Copyright (C) 2004 Sami Nopanen
*
* 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 WINE_FILEDESCRIPTION_STR "Wine Cards Library"
#define WINE_FILENAME_STR "cards.dll"
#define WINE_FILEVERSION 5,0,2134,1
#define WINE_FILEVERSION_STR "5.00.2134.1"
#define WINE_PRODUCTVERSION 5,0,2134,1
#define WINE_PRODUCTVERSION_STR "5.00.2134.1"
#include "wine/wine_common_ver.rc"

View file

@ -1,579 +0,0 @@
/*
* base64 encoder/decoder
*
* Copyright 2005 by Kai Blin
* Copyright 2006 Juan Lang
*
* 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 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 <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wincrypt.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt);
#define CERT_HEADER "-----BEGIN CERTIFICATE-----"
#define CERT_TRAILER "-----END CERTIFICATE-----"
#define CERT_REQUEST_HEADER "-----BEGIN NEW CERTIFICATE REQUEST-----"
#define CERT_REQUEST_TRAILER "-----END NEW CERTIFICATE REQUEST-----"
#define X509_HEADER "-----BEGIN X509 CRL-----"
#define X509_TRAILER "-----END X509 CRL-----"
static const char b64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
typedef BOOL (*BinaryToStringAFunc)(const BYTE *pbBinary,
DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString);
static BOOL EncodeBinaryToBinaryA(const BYTE *pbBinary,
DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString)
{
BOOL ret = TRUE;
if (*pcchString < cbBinary)
{
if (!pszString)
*pcchString = cbBinary;
else
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
*pcchString = cbBinary;
ret = FALSE;
}
}
else
{
if (cbBinary)
memcpy(pszString, pbBinary, cbBinary);
*pcchString = cbBinary;
}
return ret;
}
static LONG encodeBase64A(const BYTE *in_buf, int in_len, LPCSTR sep,
char* out_buf, DWORD *out_len)
{
int div, i;
const BYTE *d = in_buf;
int bytes = (in_len*8 + 5)/6, pad_bytes = (bytes % 4) ? 4 - (bytes % 4) : 0;
DWORD needed;
LPSTR ptr;
TRACE("bytes is %d, pad bytes is %d\n", bytes, pad_bytes);
needed = bytes + pad_bytes + 1;
needed += (needed / 64 + 1) * strlen(sep);
if (needed > *out_len)
{
*out_len = needed;
return ERROR_INSUFFICIENT_BUFFER;
}
else
*out_len = needed;
/* Three bytes of input give 4 chars of output */
div = in_len / 3;
ptr = out_buf;
i = 0;
while (div > 0)
{
if (i && i % 64 == 0)
{
strcpy(ptr, sep);
ptr += strlen(sep);
}
/* first char is the first 6 bits of the first byte*/
*ptr++ = b64[ ( d[0] >> 2) & 0x3f ];
/* second char is the last 2 bits of the first byte and the first 4
* bits of the second byte */
*ptr++ = b64[ ((d[0] << 4) & 0x30) | (d[1] >> 4 & 0x0f)];
/* third char is the last 4 bits of the second byte and the first 2
* bits of the third byte */
*ptr++ = b64[ ((d[1] << 2) & 0x3c) | (d[2] >> 6 & 0x03)];
/* fourth char is the remaining 6 bits of the third byte */
*ptr++ = b64[ d[2] & 0x3f];
i += 4;
d += 3;
div--;
}
switch(pad_bytes)
{
case 1:
/* first char is the first 6 bits of the first byte*/
*ptr++ = b64[ ( d[0] >> 2) & 0x3f ];
/* second char is the last 2 bits of the first byte and the first 4
* bits of the second byte */
*ptr++ = b64[ ((d[0] << 4) & 0x30) | (d[1] >> 4 & 0x0f)];
/* third char is the last 4 bits of the second byte padded with
* two zeroes */
*ptr++ = b64[ ((d[1] << 2) & 0x3c) ];
/* fourth char is a = to indicate one byte of padding */
*ptr++ = '=';
break;
case 2:
/* first char is the first 6 bits of the first byte*/
*ptr++ = b64[ ( d[0] >> 2) & 0x3f ];
/* second char is the last 2 bits of the first byte padded with
* four zeroes*/
*ptr++ = b64[ ((d[0] << 4) & 0x30)];
/* third char is = to indicate padding */
*ptr++ = '=';
/* fourth char is = to indicate padding */
*ptr++ = '=';
break;
}
strcpy(ptr, sep);
return ERROR_SUCCESS;
}
static BOOL BinaryToBase64A(const BYTE *pbBinary,
DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString)
{
static const char crlf[] = "\r\n", lf[] = "\n";
BOOL ret = TRUE;
LPCSTR header = NULL, trailer = NULL, sep = NULL;
DWORD charsNeeded;
if (dwFlags & CRYPT_STRING_NOCR)
sep = lf;
else
sep = crlf;
switch (dwFlags & 0x7fffffff)
{
case CRYPT_STRING_BASE64:
/* no header or footer */
break;
case CRYPT_STRING_BASE64HEADER:
header = CERT_HEADER;
trailer = CERT_TRAILER;
break;
case CRYPT_STRING_BASE64REQUESTHEADER:
header = CERT_REQUEST_HEADER;
trailer = CERT_REQUEST_TRAILER;
break;
case CRYPT_STRING_BASE64X509CRLHEADER:
header = X509_HEADER;
trailer = X509_TRAILER;
break;
}
charsNeeded = 0;
encodeBase64A(pbBinary, cbBinary, sep, NULL, &charsNeeded);
charsNeeded += strlen(sep);
if (header)
charsNeeded += strlen(header) + strlen(sep);
if (trailer)
charsNeeded += strlen(trailer) + strlen(sep);
if (charsNeeded <= *pcchString)
{
LPSTR ptr = pszString;
DWORD size = charsNeeded;
if (header)
{
strcpy(ptr, header);
ptr += strlen(ptr);
strcpy(ptr, sep);
ptr += strlen(sep);
}
encodeBase64A(pbBinary, cbBinary, sep, ptr, &size);
ptr += size - 1;
if (trailer)
{
strcpy(ptr, trailer);
ptr += strlen(ptr);
strcpy(ptr, sep);
ptr += strlen(sep);
}
*pcchString = charsNeeded - 1;
}
else if (pszString)
{
*pcchString = charsNeeded;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
ret = FALSE;
}
else
*pcchString = charsNeeded;
return ret;
}
BOOL WINAPI CryptBinaryToStringA(const BYTE *pbBinary,
DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString)
{
BinaryToStringAFunc encoder = NULL;
TRACE("(%p, %ld, %08lx, %p, %p)\n", pbBinary, cbBinary, dwFlags, pszString,
pcchString);
if (!pbBinary)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!pcchString)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
switch (dwFlags & 0x7fffffff)
{
case CRYPT_STRING_BINARY:
encoder = EncodeBinaryToBinaryA;
break;
case CRYPT_STRING_BASE64:
case CRYPT_STRING_BASE64HEADER:
case CRYPT_STRING_BASE64REQUESTHEADER:
case CRYPT_STRING_BASE64X509CRLHEADER:
encoder = BinaryToBase64A;
break;
case CRYPT_STRING_HEX:
case CRYPT_STRING_HEXASCII:
case CRYPT_STRING_HEXADDR:
case CRYPT_STRING_HEXASCIIADDR:
FIXME("Unimplemented type %ld\n", dwFlags & 0x7fffffff);
/* fall through */
default:
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return encoder(pbBinary, cbBinary, dwFlags, pszString, pcchString);
}
static inline BYTE decodeBase64Byte(char c)
{
BYTE ret;
if (c >= 'A' && c <= 'Z')
ret = c - 'A';
else if (c >= 'a' && c <= 'z')
ret = c - 'a' + 26;
else if (c >= '0' && c <= '9')
ret = c - '0' + 52;
else if (c == '+')
ret = 62;
else if (c == '/')
ret = 63;
else
ret = 64;
return ret;
}
static LONG decodeBase64Block(const char *in_buf, int in_len,
const char **nextBlock, PBYTE out_buf, DWORD *out_len)
{
int len = in_len, i;
const char *d = in_buf;
int ip0, ip1, ip2, ip3;
if (len < 4)
return ERROR_INVALID_DATA;
i = 0;
if (d[2] == '=')
{
if ((ip0 = decodeBase64Byte(d[0])) > 63)
return ERROR_INVALID_DATA;
if ((ip1 = decodeBase64Byte(d[1])) > 63)
return ERROR_INVALID_DATA;
if (out_buf)
out_buf[i] = (ip0 << 2) | (ip1 >> 4);
i++;
}
else if (d[3] == '=')
{
if ((ip0 = decodeBase64Byte(d[0])) > 63)
return ERROR_INVALID_DATA;
if ((ip1 = decodeBase64Byte(d[1])) > 63)
return ERROR_INVALID_DATA;
if ((ip2 = decodeBase64Byte(d[2])) > 63)
return ERROR_INVALID_DATA;
if (out_buf)
{
out_buf[i + 0] = (ip0 << 2) | (ip1 >> 4);
out_buf[i + 1] = (ip1 << 4) | (ip2 >> 2);
}
i += 2;
}
else
{
if ((ip0 = decodeBase64Byte(d[0])) > 63)
return ERROR_INVALID_DATA;
if ((ip1 = decodeBase64Byte(d[1])) > 63)
return ERROR_INVALID_DATA;
if ((ip2 = decodeBase64Byte(d[2])) > 63)
return ERROR_INVALID_DATA;
if ((ip3 = decodeBase64Byte(d[3])) > 63)
return ERROR_INVALID_DATA;
if (out_buf)
{
out_buf[i + 0] = (ip0 << 2) | (ip1 >> 4);
out_buf[i + 1] = (ip1 << 4) | (ip2 >> 2);
out_buf[i + 2] = (ip2 << 6) | ip3;
}
i += 3;
}
if (len >= 6 && d[4] == '\r' && d[5] == '\n')
*nextBlock = d + 6;
else if (len >= 5 && d[4] == '\n')
*nextBlock = d + 5;
else if (len >= 4 && d[4])
*nextBlock = d + 4;
else
*nextBlock = NULL;
*out_len = i;
return ERROR_SUCCESS;
}
/* Unlike CryptStringToBinaryA, cchString is guaranteed to be the length of the
* string to convert.
*/
typedef LONG (*StringToBinaryAFunc)(LPCSTR pszString, DWORD cchString,
BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags);
static LONG Base64ToBinaryA(LPCSTR pszString, DWORD cchString,
BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
{
LONG ret = ERROR_SUCCESS;
const char *nextBlock;
DWORD outLen = 0;
nextBlock = pszString;
while (nextBlock && !ret)
{
DWORD len = 0;
ret = decodeBase64Block(nextBlock, cchString - (nextBlock - pszString),
&nextBlock, pbBinary ? pbBinary + outLen : NULL, &len);
if (!ret)
outLen += len;
if (cchString - (nextBlock - pszString) <= 0)
nextBlock = NULL;
}
*pcbBinary = outLen;
if (!ret)
{
if (pdwSkip)
*pdwSkip = 0;
if (pdwFlags)
*pdwFlags = CRYPT_STRING_BASE64;
}
else if (ret == ERROR_INSUFFICIENT_BUFFER)
{
if (!pbBinary)
ret = ERROR_SUCCESS;
}
return ret;
}
static LONG Base64WithHeaderAndTrailerToBinaryA(LPCSTR pszString,
DWORD cchString, LPCSTR header, LPCSTR trailer, BYTE *pbBinary,
DWORD *pcbBinary, DWORD *pdwSkip)
{
LONG ret;
LPCSTR ptr;
if (cchString > strlen(header) + strlen(trailer)
&& (ptr = strstr(pszString, header)) != NULL)
{
LPCSTR trailerSpot = pszString + cchString - strlen(trailer);
if (pszString[cchString - 1] == '\n')
{
cchString--;
trailerSpot--;
}
if (pszString[cchString - 1] == '\r')
{
cchString--;
trailerSpot--;
}
if (!strncmp(trailerSpot, trailer, strlen(trailer)))
{
if (pdwSkip)
*pdwSkip = ptr - pszString;
ptr += strlen(header);
if (*ptr == '\r') ptr++;
if (*ptr == '\n') ptr++;
cchString -= ptr - pszString + strlen(trailer);
ret = Base64ToBinaryA(ptr, cchString, pbBinary, pcbBinary, NULL,
NULL);
}
else
ret = ERROR_INVALID_DATA;
}
else
ret = ERROR_INVALID_DATA;
return ret;
}
static LONG Base64HeaderToBinaryA(LPCSTR pszString, DWORD cchString,
BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
{
LONG ret = Base64WithHeaderAndTrailerToBinaryA(pszString, cchString,
CERT_HEADER, CERT_TRAILER, pbBinary, pcbBinary, pdwSkip);
if (!ret && pdwFlags)
*pdwFlags = CRYPT_STRING_BASE64HEADER;
return ret;
}
static LONG Base64RequestHeaderToBinaryA(LPCSTR pszString, DWORD cchString,
BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
{
LONG ret = Base64WithHeaderAndTrailerToBinaryA(pszString, cchString,
CERT_REQUEST_HEADER, CERT_REQUEST_TRAILER, pbBinary, pcbBinary, pdwSkip);
if (!ret && pdwFlags)
*pdwFlags = CRYPT_STRING_BASE64REQUESTHEADER;
return ret;
}
static LONG Base64X509HeaderToBinaryA(LPCSTR pszString, DWORD cchString,
BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
{
LONG ret = Base64WithHeaderAndTrailerToBinaryA(pszString, cchString,
X509_HEADER, X509_TRAILER, pbBinary, pcbBinary, pdwSkip);
if (!ret && pdwFlags)
*pdwFlags = CRYPT_STRING_BASE64X509CRLHEADER;
return ret;
}
static LONG Base64AnyToBinaryA(LPCSTR pszString, DWORD cchString,
BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
{
LONG ret;
ret = Base64HeaderToBinaryA(pszString, cchString, pbBinary, pcbBinary,
pdwSkip, pdwFlags);
if (ret == ERROR_INVALID_DATA)
ret = Base64ToBinaryA(pszString, cchString, pbBinary, pcbBinary,
pdwSkip, pdwFlags);
return ret;
}
static LONG DecodeBinaryToBinaryA(LPCSTR pszString, DWORD cchString,
BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
{
LONG ret = ERROR_SUCCESS;
if (*pcbBinary < cchString)
{
if (!pbBinary)
*pcbBinary = cchString;
else
{
ret = ERROR_INSUFFICIENT_BUFFER;
*pcbBinary = cchString;
}
}
else
{
if (cchString)
memcpy(pbBinary, pszString, cchString);
*pcbBinary = cchString;
}
return ret;
}
static LONG DecodeAnyA(LPCSTR pszString, DWORD cchString,
BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
{
LONG ret;
ret = Base64HeaderToBinaryA(pszString, cchString, pbBinary, pcbBinary,
pdwSkip, pdwFlags);
if (ret == ERROR_INVALID_DATA)
ret = Base64ToBinaryA(pszString, cchString, pbBinary, pcbBinary,
pdwSkip, pdwFlags);
if (ret == ERROR_INVALID_DATA)
ret = DecodeBinaryToBinaryA(pszString, cchString, pbBinary, pcbBinary,
pdwSkip, pdwFlags);
return ret;
}
BOOL WINAPI CryptStringToBinaryA(LPCSTR pszString,
DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary,
DWORD *pdwSkip, DWORD *pdwFlags)
{
StringToBinaryAFunc decoder;
LONG ret;
TRACE("(%s, %ld, %08lx, %p, %p, %p, %p)\n", debugstr_a(pszString),
cchString, dwFlags, pbBinary, pcbBinary, pdwSkip, pdwFlags);
if (!pszString)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
/* Only the bottom byte contains valid types */
if (dwFlags & 0xfffffff0)
{
SetLastError(ERROR_INVALID_DATA);
return FALSE;
}
switch (dwFlags)
{
case CRYPT_STRING_BASE64_ANY:
decoder = Base64AnyToBinaryA;
break;
case CRYPT_STRING_BASE64:
decoder = Base64ToBinaryA;
break;
case CRYPT_STRING_BASE64HEADER:
decoder = Base64HeaderToBinaryA;
break;
case CRYPT_STRING_BASE64REQUESTHEADER:
decoder = Base64RequestHeaderToBinaryA;
break;
case CRYPT_STRING_BASE64X509CRLHEADER:
decoder = Base64X509HeaderToBinaryA;
break;
case CRYPT_STRING_BINARY:
decoder = DecodeBinaryToBinaryA;
break;
case CRYPT_STRING_ANY:
decoder = DecodeAnyA;
break;
case CRYPT_STRING_HEX:
case CRYPT_STRING_HEXASCII:
case CRYPT_STRING_HEXADDR:
case CRYPT_STRING_HEXASCIIADDR:
FIXME("Unimplemented type %ld\n", dwFlags & 0x7fffffff);
/* fall through */
default:
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!cchString)
cchString = strlen(pszString);
ret = decoder(pszString, cchString, pbBinary, pcbBinary, pdwSkip, pdwFlags);
if (ret)
SetLastError(ret);
return (ret == ERROR_SUCCESS) ? TRUE : FALSE;
}

View file

@ -1,308 +0,0 @@
/*
* Copyright 2006 Juan Lang
*
* 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 <assert.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wincrypt.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "crypt32_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt);
typedef enum _ContextType {
ContextTypeData,
ContextTypeLink,
} ContextType;
typedef struct _BASE_CONTEXT
{
LONG ref;
ContextType type;
} BASE_CONTEXT, *PBASE_CONTEXT;
typedef struct _DATA_CONTEXT
{
LONG ref;
ContextType type; /* always ContextTypeData */
PCONTEXT_PROPERTY_LIST properties;
} DATA_CONTEXT, *PDATA_CONTEXT;
typedef struct _LINK_CONTEXT
{
LONG ref;
ContextType type; /* always ContextTypeLink */
PBASE_CONTEXT linked;
} LINK_CONTEXT, *PLINK_CONTEXT;
#define CONTEXT_FROM_BASE_CONTEXT(p, s) ((LPBYTE)(p) - (s))
#define BASE_CONTEXT_FROM_CONTEXT(p, s) (PBASE_CONTEXT)((LPBYTE)(p) + (s))
void *Context_CreateDataContext(size_t contextSize)
{
void *ret = CryptMemAlloc(contextSize + sizeof(DATA_CONTEXT));
if (ret)
{
PDATA_CONTEXT context = (PDATA_CONTEXT)((LPBYTE)ret + contextSize);
context->ref = 1;
context->type = ContextTypeData;
context->properties = ContextPropertyList_Create();
if (!context->properties)
{
CryptMemFree(ret);
ret = NULL;
}
}
return ret;
}
void *Context_CreateLinkContext(unsigned int contextSize, void *linked, unsigned int extra,
BOOL addRef)
{
void *context = CryptMemAlloc(contextSize + sizeof(LINK_CONTEXT) + extra);
TRACE("(%d, %p, %d)\n", contextSize, linked, extra);
if (context)
{
PLINK_CONTEXT linkContext = (PLINK_CONTEXT)BASE_CONTEXT_FROM_CONTEXT(
context, contextSize);
PBASE_CONTEXT linkedBase = BASE_CONTEXT_FROM_CONTEXT(linked,
contextSize);
memcpy(context, linked, contextSize);
linkContext->ref = 1;
linkContext->type = ContextTypeLink;
linkContext->linked = linkedBase;
if (addRef)
InterlockedIncrement(&linkedBase->ref);
TRACE("%p's ref count is %ld\n", context, linkContext->ref);
}
return context;
}
void Context_AddRef(void *context, size_t contextSize)
{
PBASE_CONTEXT baseContext = BASE_CONTEXT_FROM_CONTEXT(context, contextSize);
InterlockedIncrement(&baseContext->ref);
}
void *Context_GetExtra(const void *context, size_t contextSize)
{
PBASE_CONTEXT baseContext = BASE_CONTEXT_FROM_CONTEXT(context, contextSize);
assert(baseContext->type == ContextTypeLink);
return (LPBYTE)baseContext + sizeof(LINK_CONTEXT);
}
void *Context_GetLinkedContext(void *context, size_t contextSize)
{
PBASE_CONTEXT baseContext = BASE_CONTEXT_FROM_CONTEXT(context, contextSize);
assert(baseContext->type == ContextTypeLink);
return CONTEXT_FROM_BASE_CONTEXT(((PLINK_CONTEXT)baseContext)->linked,
contextSize);
}
PCONTEXT_PROPERTY_LIST Context_GetProperties(void *context, size_t contextSize)
{
PBASE_CONTEXT ptr = BASE_CONTEXT_FROM_CONTEXT(context, contextSize);
while (ptr && ptr->type == ContextTypeLink)
ptr = ((PLINK_CONTEXT)ptr)->linked;
return (ptr && ptr->type == ContextTypeData) ?
((PDATA_CONTEXT)ptr)->properties : NULL;
}
void Context_Release(void *context, size_t contextSize,
ContextFreeFunc dataContextFree)
{
PBASE_CONTEXT base = BASE_CONTEXT_FROM_CONTEXT(context, contextSize);
if (InterlockedDecrement(&base->ref) == 0)
{
TRACE("freeing %p\n", context);
switch (base->type)
{
case ContextTypeData:
ContextPropertyList_Free(((PDATA_CONTEXT)base)->properties);
dataContextFree(context);
break;
case ContextTypeLink:
/* The linked context is of the same type as this, so release
* it as well, using the same offset and data free function.
*/
Context_Release(CONTEXT_FROM_BASE_CONTEXT(
((PLINK_CONTEXT)base)->linked, contextSize), contextSize,
dataContextFree);
break;
default:
assert(0);
}
CryptMemFree(context);
}
else
TRACE("%p's ref count is %ld\n", context, base->ref);
}
void Context_CopyProperties(const void *to, const void *from,
size_t contextSize)
{
PCONTEXT_PROPERTY_LIST toProperties, fromProperties;
toProperties = Context_GetProperties((void *)to, contextSize);
fromProperties = Context_GetProperties((void *)from, contextSize);
ContextPropertyList_Copy(toProperties, fromProperties);
}
struct ContextList
{
PCWINE_CONTEXT_INTERFACE contextInterface;
size_t contextSize;
CRITICAL_SECTION cs;
struct list contexts;
};
struct ContextList *ContextList_Create(
PCWINE_CONTEXT_INTERFACE contextInterface, size_t contextSize)
{
struct ContextList *list = CryptMemAlloc(sizeof(struct ContextList));
if (list)
{
list->contextInterface = contextInterface;
list->contextSize = contextSize;
InitializeCriticalSection(&list->cs);
list_init(&list->contexts);
}
return list;
}
static inline struct list *ContextList_ContextToEntry(struct ContextList *list,
const void *context)
{
struct list *ret;
if (context)
ret = (struct list *)Context_GetExtra(context, list->contextSize);
else
ret = NULL;
return ret;
}
static inline void *ContextList_EntryToContext(struct ContextList *list,
struct list *entry)
{
return (LPBYTE)entry - sizeof(LINK_CONTEXT) - list->contextSize;
}
void *ContextList_Add(struct ContextList *list, void *toLink, void *toReplace)
{
void *context;
TRACE("(%p, %p, %p)\n", list, toLink, toReplace);
context = Context_CreateLinkContext(list->contextSize, toLink,
sizeof(struct list), TRUE);
if (context)
{
struct list *entry = ContextList_ContextToEntry(list, context);
TRACE("adding %p\n", context);
EnterCriticalSection(&list->cs);
if (toReplace)
{
struct list *existing = ContextList_ContextToEntry(list, toReplace);
entry->prev = existing->prev;
entry->next = existing->next;
entry->prev->next = entry;
entry->next->prev = entry;
existing->prev = existing->next = existing;
list->contextInterface->free(toReplace);
}
else
list_add_tail(&list->contexts, entry);
LeaveCriticalSection(&list->cs);
}
return context;
}
void *ContextList_Enum(struct ContextList *list, void *pPrev)
{
struct list *listNext;
void *ret;
EnterCriticalSection(&list->cs);
if (pPrev)
{
struct list *prevEntry = ContextList_ContextToEntry(list, pPrev);
listNext = list_next(&list->contexts, prevEntry);
list->contextInterface->free(pPrev);
}
else
listNext = list_next(&list->contexts, &list->contexts);
LeaveCriticalSection(&list->cs);
if (listNext)
{
ret = ContextList_EntryToContext(list, listNext);
list->contextInterface->duplicate(ret);
}
else
ret = NULL;
return ret;
}
void ContextList_Delete(struct ContextList *list, void *context)
{
struct list *entry = ContextList_ContextToEntry(list, context);
EnterCriticalSection(&list->cs);
list_remove(entry);
LeaveCriticalSection(&list->cs);
list->contextInterface->free(context);
}
void ContextList_Empty(struct ContextList *list)
{
struct list *entry, *next;
EnterCriticalSection(&list->cs);
LIST_FOR_EACH_SAFE(entry, next, &list->contexts)
{
const void *context = ContextList_EntryToContext(list, entry);
TRACE("removing %p\n", context);
list_remove(entry);
list->contextInterface->free(context);
}
LeaveCriticalSection(&list->cs);
}
void ContextList_Free(struct ContextList *list)
{
ContextList_Empty(list);
DeleteCriticalSection(&list->cs);
CryptMemFree(list);
}

View file

@ -1,535 +0,0 @@
/*
* Copyright 2006 Juan Lang
*
* 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 <assert.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wincrypt.h"
#include "wine/debug.h"
#include "crypt32_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt);
PCCRL_CONTEXT WINAPI CertCreateCRLContext(DWORD dwCertEncodingType,
const BYTE* pbCrlEncoded, DWORD cbCrlEncoded)
{
PCRL_CONTEXT crl = NULL;
BOOL ret;
PCRL_INFO crlInfo = NULL;
DWORD size = 0;
TRACE("(%08lx, %p, %ld)\n", dwCertEncodingType, pbCrlEncoded,
cbCrlEncoded);
if ((dwCertEncodingType & CERT_ENCODING_TYPE_MASK) != X509_ASN_ENCODING)
{
SetLastError(E_INVALIDARG);
return NULL;
}
ret = CryptDecodeObjectEx(dwCertEncodingType, X509_CERT_CRL_TO_BE_SIGNED,
pbCrlEncoded, cbCrlEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL,
(BYTE *)&crlInfo, &size);
if (ret)
{
BYTE *data = NULL;
crl = (PCRL_CONTEXT)Context_CreateDataContext(sizeof(CRL_CONTEXT));
if (!crl)
goto end;
data = CryptMemAlloc(cbCrlEncoded);
if (!data)
{
CryptMemFree(crl);
crl = NULL;
goto end;
}
memcpy(data, pbCrlEncoded, cbCrlEncoded);
crl->dwCertEncodingType = dwCertEncodingType;
crl->pbCrlEncoded = data;
crl->cbCrlEncoded = cbCrlEncoded;
crl->pCrlInfo = crlInfo;
crl->hCertStore = 0;
}
end:
return (PCCRL_CONTEXT)crl;
}
BOOL WINAPI CertAddEncodedCRLToStore(HCERTSTORE hCertStore,
DWORD dwCertEncodingType, const BYTE *pbCrlEncoded, DWORD cbCrlEncoded,
DWORD dwAddDisposition, PCCRL_CONTEXT *ppCrlContext)
{
PCCRL_CONTEXT crl = CertCreateCRLContext(dwCertEncodingType,
pbCrlEncoded, cbCrlEncoded);
BOOL ret;
TRACE("(%p, %08lx, %p, %ld, %08lx, %p)\n", hCertStore, dwCertEncodingType,
pbCrlEncoded, cbCrlEncoded, dwAddDisposition, ppCrlContext);
if (crl)
{
ret = CertAddCRLContextToStore(hCertStore, crl, dwAddDisposition,
ppCrlContext);
CertFreeCRLContext(crl);
}
else
ret = FALSE;
return ret;
}
typedef BOOL (*CrlCompareFunc)(PCCRL_CONTEXT pCrlContext, DWORD dwType,
DWORD dwFlags, const void *pvPara);
static BOOL compare_crl_any(PCCRL_CONTEXT pCrlContext, DWORD dwType,
DWORD dwFlags, const void *pvPara)
{
return TRUE;
}
static BOOL compare_crl_issued_by(PCCRL_CONTEXT pCrlContext, DWORD dwType,
DWORD dwFlags, const void *pvPara)
{
BOOL ret;
if (pvPara)
{
PCCERT_CONTEXT issuer = (PCCERT_CONTEXT)pvPara;
ret = CertCompareCertificateName(issuer->dwCertEncodingType,
&issuer->pCertInfo->Issuer, &pCrlContext->pCrlInfo->Issuer);
}
else
ret = TRUE;
return ret;
}
static BOOL compare_crl_existing(PCCRL_CONTEXT pCrlContext, DWORD dwType,
DWORD dwFlags, const void *pvPara)
{
BOOL ret;
if (pvPara)
{
PCCRL_CONTEXT crl = (PCCRL_CONTEXT)pvPara;
ret = CertCompareCertificateName(pCrlContext->dwCertEncodingType,
&pCrlContext->pCrlInfo->Issuer, &crl->pCrlInfo->Issuer);
}
else
ret = TRUE;
return ret;
}
PCCRL_CONTEXT WINAPI CertFindCRLInStore(HCERTSTORE hCertStore,
DWORD dwCertEncodingType, DWORD dwFindFlags, DWORD dwFindType,
const void *pvFindPara, PCCRL_CONTEXT pPrevCrlContext)
{
PCCRL_CONTEXT ret;
CrlCompareFunc compare;
TRACE("(%p, %ld, %ld, %ld, %p, %p)\n", hCertStore, dwCertEncodingType,
dwFindFlags, dwFindType, pvFindPara, pPrevCrlContext);
switch (dwFindType)
{
case CRL_FIND_ANY:
compare = compare_crl_any;
break;
case CRL_FIND_ISSUED_BY:
compare = compare_crl_issued_by;
break;
case CRL_FIND_EXISTING:
compare = compare_crl_existing;
break;
default:
FIXME("find type %08lx unimplemented\n", dwFindType);
compare = NULL;
}
if (compare)
{
BOOL matches = FALSE;
ret = pPrevCrlContext;
do {
ret = CertEnumCRLsInStore(hCertStore, ret);
if (ret)
matches = compare(ret, dwFindType, dwFindFlags, pvFindPara);
} while (ret != NULL && !matches);
if (!ret)
SetLastError(CRYPT_E_NOT_FOUND);
}
else
{
SetLastError(CRYPT_E_NOT_FOUND);
ret = NULL;
}
return ret;
}
PCCRL_CONTEXT WINAPI CertGetCRLFromStore(HCERTSTORE hCertStore,
PCCERT_CONTEXT pIssuerContext, PCCRL_CONTEXT pPrevCrlContext, DWORD *pdwFlags)
{
static const DWORD supportedFlags = CERT_STORE_SIGNATURE_FLAG |
CERT_STORE_TIME_VALIDITY_FLAG | CERT_STORE_BASE_CRL_FLAG |
CERT_STORE_DELTA_CRL_FLAG;
PCCRL_CONTEXT ret;
TRACE("(%p, %p, %p, %08lx)\n", hCertStore, pIssuerContext, pPrevCrlContext,
*pdwFlags);
if (*pdwFlags & ~supportedFlags)
{
SetLastError(E_INVALIDARG);
return NULL;
}
if (pIssuerContext)
ret = CertFindCRLInStore(hCertStore, pIssuerContext->dwCertEncodingType,
0, CRL_FIND_ISSUED_BY, pIssuerContext, pPrevCrlContext);
else
ret = CertFindCRLInStore(hCertStore, 0, 0, CRL_FIND_ANY, NULL,
pPrevCrlContext);
if (ret)
{
if (*pdwFlags & CERT_STORE_TIME_VALIDITY_FLAG)
{
if (0 == CertVerifyCRLTimeValidity(NULL, ret->pCrlInfo))
*pdwFlags &= ~CERT_STORE_TIME_VALIDITY_FLAG;
}
if (*pdwFlags & CERT_STORE_SIGNATURE_FLAG)
{
if (CryptVerifyCertificateSignatureEx(0, ret->dwCertEncodingType,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_CRL, (void *)ret,
CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT, (void *)pIssuerContext, 0,
NULL))
*pdwFlags &= ~CERT_STORE_SIGNATURE_FLAG;
}
}
return ret;
}
PCCRL_CONTEXT WINAPI CertDuplicateCRLContext(PCCRL_CONTEXT pCrlContext)
{
TRACE("(%p)\n", pCrlContext);
Context_AddRef((void *)pCrlContext, sizeof(CRL_CONTEXT));
return pCrlContext;
}
static void CrlDataContext_Free(void *context)
{
PCRL_CONTEXT crlContext = (PCRL_CONTEXT)context;
CryptMemFree(crlContext->pbCrlEncoded);
LocalFree(crlContext->pCrlInfo);
}
BOOL WINAPI CertFreeCRLContext( PCCRL_CONTEXT pCrlContext)
{
TRACE("(%p)\n", pCrlContext);
if (pCrlContext)
Context_Release((void *)pCrlContext, sizeof(CRL_CONTEXT),
CrlDataContext_Free);
return TRUE;
}
DWORD WINAPI CertEnumCRLContextProperties(PCCRL_CONTEXT pCRLContext,
DWORD dwPropId)
{
PCONTEXT_PROPERTY_LIST properties = Context_GetProperties(
(void *)pCRLContext, sizeof(CRL_CONTEXT));
DWORD ret;
TRACE("(%p, %ld)\n", pCRLContext, dwPropId);
if (properties)
ret = ContextPropertyList_EnumPropIDs(properties, dwPropId);
else
ret = 0;
return ret;
}
static BOOL WINAPI CRLContext_SetProperty(void *context, DWORD dwPropId,
DWORD dwFlags, const void *pvData);
static BOOL CRLContext_GetHashProp(void *context, DWORD dwPropId,
ALG_ID algID, const BYTE *toHash, DWORD toHashLen, void *pvData,
DWORD *pcbData)
{
BOOL ret = CryptHashCertificate(0, algID, 0, toHash, toHashLen, pvData,
pcbData);
if (ret)
{
CRYPT_DATA_BLOB blob = { *pcbData, pvData };
ret = CRLContext_SetProperty(context, dwPropId, 0, &blob);
}
return ret;
}
static BOOL WINAPI CRLContext_GetProperty(void *context, DWORD dwPropId,
void *pvData, DWORD *pcbData)
{
PCCRL_CONTEXT pCRLContext = (PCCRL_CONTEXT)context;
PCONTEXT_PROPERTY_LIST properties =
Context_GetProperties(context, sizeof(CRL_CONTEXT));
BOOL ret;
CRYPT_DATA_BLOB blob;
TRACE("(%p, %ld, %p, %p)\n", context, dwPropId, pvData, pcbData);
if (properties)
ret = ContextPropertyList_FindProperty(properties, dwPropId, &blob);
else
ret = FALSE;
if (ret)
{
if (!pvData)
{
*pcbData = blob.cbData;
ret = TRUE;
}
else if (*pcbData < blob.cbData)
{
SetLastError(ERROR_MORE_DATA);
*pcbData = blob.cbData;
}
else
{
memcpy(pvData, blob.pbData, blob.cbData);
*pcbData = blob.cbData;
ret = TRUE;
}
}
else
{
/* Implicit properties */
switch (dwPropId)
{
case CERT_SHA1_HASH_PROP_ID:
ret = CRLContext_GetHashProp(context, dwPropId, CALG_SHA1,
pCRLContext->pbCrlEncoded, pCRLContext->cbCrlEncoded, pvData,
pcbData);
break;
case CERT_MD5_HASH_PROP_ID:
ret = CRLContext_GetHashProp(context, dwPropId, CALG_MD5,
pCRLContext->pbCrlEncoded, pCRLContext->cbCrlEncoded, pvData,
pcbData);
break;
default:
SetLastError(CRYPT_E_NOT_FOUND);
}
}
TRACE("returning %d\n", ret);
return ret;
}
BOOL WINAPI CertGetCRLContextProperty(PCCRL_CONTEXT pCRLContext,
DWORD dwPropId, void *pvData, DWORD *pcbData)
{
BOOL ret;
TRACE("(%p, %ld, %p, %p)\n", pCRLContext, dwPropId, pvData, pcbData);
switch (dwPropId)
{
case 0:
case CERT_CERT_PROP_ID:
case CERT_CRL_PROP_ID:
case CERT_CTL_PROP_ID:
SetLastError(E_INVALIDARG);
ret = FALSE;
break;
case CERT_ACCESS_STATE_PROP_ID:
if (!pvData)
{
*pcbData = sizeof(DWORD);
ret = TRUE;
}
else if (*pcbData < sizeof(DWORD))
{
SetLastError(ERROR_MORE_DATA);
*pcbData = sizeof(DWORD);
ret = FALSE;
}
else
{
*(DWORD *)pvData =
CertStore_GetAccessState(pCRLContext->hCertStore);
ret = TRUE;
}
break;
default:
ret = CRLContext_GetProperty((void *)pCRLContext, dwPropId, pvData,
pcbData);
}
return ret;
}
static BOOL WINAPI CRLContext_SetProperty(void *context, DWORD dwPropId,
DWORD dwFlags, const void *pvData)
{
PCONTEXT_PROPERTY_LIST properties =
Context_GetProperties(context, sizeof(CERT_CONTEXT));
BOOL ret;
TRACE("(%p, %ld, %08lx, %p)\n", context, dwPropId, dwFlags, pvData);
if (!properties)
ret = FALSE;
else if (!pvData)
{
ContextPropertyList_RemoveProperty(properties, dwPropId);
ret = TRUE;
}
else
{
switch (dwPropId)
{
case CERT_AUTO_ENROLL_PROP_ID:
case CERT_CTL_USAGE_PROP_ID: /* same as CERT_ENHKEY_USAGE_PROP_ID */
case CERT_DESCRIPTION_PROP_ID:
case CERT_FRIENDLY_NAME_PROP_ID:
case CERT_HASH_PROP_ID:
case CERT_KEY_IDENTIFIER_PROP_ID:
case CERT_MD5_HASH_PROP_ID:
case CERT_NEXT_UPDATE_LOCATION_PROP_ID:
case CERT_PUBKEY_ALG_PARA_PROP_ID:
case CERT_PVK_FILE_PROP_ID:
case CERT_SIGNATURE_HASH_PROP_ID:
case CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID:
case CERT_SUBJECT_NAME_MD5_HASH_PROP_ID:
case CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID:
case CERT_ENROLLMENT_PROP_ID:
case CERT_CROSS_CERT_DIST_POINTS_PROP_ID:
case CERT_RENEWAL_PROP_ID:
{
PCRYPT_DATA_BLOB blob = (PCRYPT_DATA_BLOB)pvData;
ret = ContextPropertyList_SetProperty(properties, dwPropId,
blob->pbData, blob->cbData);
break;
}
case CERT_DATE_STAMP_PROP_ID:
ret = ContextPropertyList_SetProperty(properties, dwPropId,
(LPBYTE)pvData, sizeof(FILETIME));
break;
default:
FIXME("%ld: stub\n", dwPropId);
ret = FALSE;
}
}
TRACE("returning %d\n", ret);
return ret;
}
BOOL WINAPI CertSetCRLContextProperty(PCCRL_CONTEXT pCRLContext,
DWORD dwPropId, DWORD dwFlags, const void *pvData)
{
BOOL ret;
TRACE("(%p, %ld, %08lx, %p)\n", pCRLContext, dwPropId, dwFlags, pvData);
/* Handle special cases for "read-only"/invalid prop IDs. Windows just
* crashes on most of these, I'll be safer.
*/
switch (dwPropId)
{
case 0:
case CERT_ACCESS_STATE_PROP_ID:
case CERT_CERT_PROP_ID:
case CERT_CRL_PROP_ID:
case CERT_CTL_PROP_ID:
SetLastError(E_INVALIDARG);
return FALSE;
}
ret = CRLContext_SetProperty((void *)pCRLContext, dwPropId, dwFlags,
pvData);
TRACE("returning %d\n", ret);
return ret;
}
BOOL WINAPI CertIsValidCRLForCertificate(PCCERT_CONTEXT pCert,
PCCRL_CONTEXT pCrl, DWORD dwFlags, void *pvReserved)
{
TRACE("(%p, %p, %08lx, %p)\n", pCert, pCrl, dwFlags, pvReserved);
return TRUE;
}
static PCRL_ENTRY CRYPT_FindCertificateInCRL(PCERT_INFO cert, PCRL_INFO crl)
{
DWORD i;
PCRL_ENTRY entry = NULL;
for (i = 0; !entry && i < crl->cCRLEntry; i++)
if (CertCompareIntegerBlob(&crl->rgCRLEntry[i].SerialNumber,
&cert->SerialNumber))
entry = &crl->rgCRLEntry[i];
return entry;
}
BOOL WINAPI CertFindCertificateInCRL(PCCERT_CONTEXT pCert,
PCCRL_CONTEXT pCrlContext, DWORD dwFlags, void *pvReserved,
PCRL_ENTRY *ppCrlEntry)
{
TRACE("(%p, %p, %08lx, %p, %p)\n", pCert, pCrlContext, dwFlags, pvReserved,
ppCrlEntry);
*ppCrlEntry = CRYPT_FindCertificateInCRL(pCert->pCertInfo,
pCrlContext->pCrlInfo);
return TRUE;
}
BOOL WINAPI CertVerifyCRLRevocation(DWORD dwCertEncodingType,
PCERT_INFO pCertId, DWORD cCrlInfo, PCRL_INFO rgpCrlInfo[])
{
DWORD i;
PCRL_ENTRY entry = NULL;
TRACE("(%08lx, %p, %ld, %p)\n", dwCertEncodingType, pCertId, cCrlInfo,
rgpCrlInfo);
for (i = 0; !entry && i < cCrlInfo; i++)
entry = CRYPT_FindCertificateInCRL(pCertId, rgpCrlInfo[i]);
return entry == NULL;
}
LONG WINAPI CertVerifyCRLTimeValidity(LPFILETIME pTimeToVerify,
PCRL_INFO pCrlInfo)
{
FILETIME fileTime;
LONG ret;
if (!pTimeToVerify)
{
SYSTEMTIME sysTime;
GetSystemTime(&sysTime);
SystemTimeToFileTime(&sysTime, &fileTime);
pTimeToVerify = &fileTime;
}
if ((ret = CompareFileTime(pTimeToVerify, &pCrlInfo->ThisUpdate)) >= 0)
{
ret = CompareFileTime(pTimeToVerify, &pCrlInfo->NextUpdate);
if (ret < 0)
ret = 0;
}
return ret;
}

View file

@ -1,27 +1,22 @@
<module name="crypt32" type="win32dll" baseaddress="${BASEADDRESS_CRYPT32}" installbase="system32" installname="crypt32.dll" allowwarnings="true">
<module name="crypt32" type="win32dll" baseaddress="${BASEADDRESS_CRYPT32}" installbase="system32" installname="crypt32.dll">
<importlibrary definition="crypt32.spec.def" />
<include base="crypt32">.</include>
<include base="ReactOS">include/reactos/wine</include>
<define name="__REACTOS__" />
<define name="__WINESRC__" />
<define name="__USE_W32API" />
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="WINVER">0x501</define>
<library>wine</library>
<library>user32</library>
<library>advapi32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>cert.c</file>
<library>kernel32</library>
<library>wine</library>
<library>advapi32</library>
<file>main.c</file>
<file>encode.c</file>
<file>cert.c</file>
<file>oid.c</file>
<file>proplist.c</file>
<file>protectdata.c</file>
<file>serialize.c</file>
<file>store.c</file>
<file>str.c</file>
<file>main.c</file>
<file>crypt32.rc</file>
<file>crypt32.spec</file>
</module>

View file

@ -17,12 +17,18 @@
* 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 REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "CryptoAPI Library\0"
#define REACTOS_STR_INTERNAL_NAME "crypt32\0"
#define REACTOS_STR_ORIGINAL_FILENAME "crypt32.dll\0"
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "cryptres.h"
#include "version.rc"
#include <reactos/version.rc>
#include "crypt32_De.rc"
#include "crypt32_En.rc"

View file

@ -78,6 +78,7 @@
@ stdcall CertSetEnhancedKeyUsage(ptr ptr)
@ stub CertStrToNameA
@ stub CertStrToNameW
@ stub CertVerifyCertificateChainPolicy
@ stub CertVerifyCRLRevocation
@ stub CertVerifyCRLTimeValidity
@ stub CertVerifyCTLUsage

View file

@ -117,7 +117,7 @@ STRINGTABLE DISCARDABLE
IDS_KEY_RECOVERY_AGENT "Agent zur Schlüsselwiederherstellung"
IDS_CERTIFICATE_TEMPLATE "Zertifikatsvorlageninformation"
IDS_ENTERPRISE_ROOT_OID "Unternehmensstamm-OID"
IDS_RDN_DUMMY_SIGNER "Attrapenunterzeichner"
IDS_RDN_DUMMY_SIGNER "Atrappenunterzeichner"
IDS_ARCHIVED_KEY_ATTR "Verschlüsselter, privater Schlüssel"
IDS_CRL_SELF_CDP "Veröffentlichte CRL Standorte"
IDS_REQUIRE_CERT_CHAIN_POLICY "Erzwinge Zertifikatskettenrichtlinie"

File diff suppressed because it is too large Load diff

View file

@ -294,7 +294,7 @@ BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void* pvObject,
return FALSE;
}
BOOL WINAPI CryptVerifyMessageSignature(/*PCRYPT_VERIFY_MESSAGE_PARA*/ void* pVerifyPara,
BOOL WINAPI CryptVerifyMessageSignature(PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
DWORD dwSignerIndex, const BYTE* pbSignedBlob, DWORD cbSignedBlob,
BYTE* pbDecoded, DWORD* pcbDecoded, PCCERT_CONTEXT* ppSignerCert)
{

View file

@ -23,6 +23,7 @@
#include "winbase.h"
#include "wincrypt.h"
#include "winreg.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/list.h"

View file

@ -843,6 +843,8 @@ BOOL WINAPI CryptProtectData(DATA_BLOB* pDataIn,
HCRYPTKEY hKey;
DWORD dwLength;
TRACE("called\n");
SetLastError(ERROR_SUCCESS);
@ -861,7 +863,7 @@ BOOL WINAPI CryptProtectData(DATA_BLOB* pDataIn,
/* Windows appears to create an empty szDataDescr instead of maintaining
* a NULL */
if (!szDataDescr)
szDataDescr=(WCHAR[]){'\0'};
szDataDescr = L'\0';
/* get crypt context */
if (!CryptAcquireContextW(&hProv,NULL,NULL,CRYPT32_PROTECTDATA_PROV,CRYPT_VERIFYCONTEXT))

View file

@ -1,28 +0,0 @@
/*
* crypt32 dll version resources
*
* Copyright (C) 2006 Juan Lang
*
* 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 WINE_FILEDESCRIPTION_STR "Wine CryptoAPI Library"
#define WINE_FILENAME_STR "crypt32.dll"
#define WINE_FILEVERSION 5,131,2600,1243
#define WINE_FILEVERSION_STR "5.131.2600.1243"
#define WINE_PRODUCTVERSION 5,131,2600,1243
#define WINE_PRODUCTVERSION_STR "5.131.2600.1243"
#include "wine/wine_common_ver.rc"