- Sync rsaenh, shdocvw, shlwapi with Wine head

svn path=/trunk/; revision=39764
This commit is contained in:
Dmitry Chapyshev 2009-02-26 10:29:58 +00:00
parent a96dc753be
commit fac8159392
7 changed files with 1410 additions and 1140 deletions

View file

@ -44,13 +44,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(handle);
* lpTable [I] Pointer to the HANDLETABLE structure, which is to be initalized.
*
* NOTES
* Note that alloc_handle_table calls init_handle_table on it's own, which
* means that you only have to call init_handle_table, if you use a global
* variable of type HANDLETABLE for your handle table. However, in this
* case you have to call destroy_handle_table when you don't need the table
* You have to call destroy_handle_table when you don't need the table
* any more.
*/
void init_handle_table(HANDLETABLE *lpTable)
void init_handle_table(struct handle_table *lpTable)
{
TRACE("(lpTable=%p)\n", lpTable);
@ -68,11 +65,8 @@ void init_handle_table(HANDLETABLE *lpTable)
*
* PARAMS
* lpTable [I] Pointer to the handle table, which is to be destroyed.
*
* NOTES
* Note that release_handle_table takes care of this.
*/
void destroy_handle_table(HANDLETABLE *lpTable)
void destroy_handle_table(struct handle_table *lpTable)
{
TRACE("(lpTable=%p)\n", lpTable);
@ -96,7 +90,7 @@ void destroy_handle_table(HANDLETABLE *lpTable)
* non zero, if handle is valid.
* zero, if handle is not valid.
*/
int is_valid_handle(HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType)
int is_valid_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType)
{
unsigned int index = HANDLE2INDEX(handle);
int ret = 0;
@ -123,82 +117,6 @@ exit:
return ret;
}
/******************************************************************************
* release_all_handles
*
* Releases all valid handles in the given handle table and shrinks the table
* to zero size.
*
* PARAMS
* lpTable [I] The table of which all valid handles shall be released.
*/
static void release_all_handles(HANDLETABLE *lpTable)
{
unsigned int i;
TRACE("(lpTable=%p)\n", lpTable);
EnterCriticalSection(&lpTable->mutex);
for (i=0; i<lpTable->iEntries; i++)
if (lpTable->paEntries[i].pObject)
release_handle(lpTable, lpTable->paEntries[i].pObject->dwType, INDEX2HANDLE(i));
LeaveCriticalSection(&lpTable->mutex);
}
/******************************************************************************
* alloc_handle_table
*
* Allocates a new handle table
*
* PARAMS
* lplpTable [O] Pointer to the variable, to which the pointer to the newly
* allocated handle table is written.
* RETURNS
* non zero, if successful
* zero, if not successful (out of process heap memory)
*
* NOTES
* If all you need is a single handle table, you may as well declare a global
* variable of type HANDLETABLE and call init_handle_table on your own.
*/
int alloc_handle_table(HANDLETABLE **lplpTable)
{
TRACE("(lplpTable=%p)\n", lplpTable);
*lplpTable = HeapAlloc(GetProcessHeap(), 0, sizeof(HANDLETABLE));
if (*lplpTable)
{
init_handle_table(*lplpTable);
return 1;
}
else
return 0;
}
/******************************************************************************
* release_handle_table
*
* Releases a handle table and frees the resources it used.
*
* PARAMS
* lpTable [I] Pointer to the handle table, which is to be released.
*
* RETURNS
* non zero, if successful
* zero, if not successful
*
* NOTES
* All valid handles still in the table are released also.
*/
int release_handle_table(HANDLETABLE *lpTable)
{
TRACE("(lpTable=%p)\n", lpTable);
release_all_handles(lpTable);
destroy_handle_table(lpTable);
return HeapFree(GetProcessHeap(), 0, lpTable);
}
/******************************************************************************
* grow_handle_table [Internal]
*
@ -214,20 +132,20 @@ int release_handle_table(HANDLETABLE *lpTable)
* NOTES
* This is a support function for alloc_handle. Do not call!
*/
static int grow_handle_table(HANDLETABLE *lpTable)
static int grow_handle_table(struct handle_table *lpTable)
{
HANDLETABLEENTRY *newEntries;
struct handle_table_entry *newEntries;
unsigned int i, newIEntries;
newIEntries = lpTable->iEntries + TABLE_SIZE_INCREMENT;
newEntries = HeapAlloc(GetProcessHeap(), 0, sizeof(HANDLETABLEENTRY)*newIEntries);
newEntries = HeapAlloc(GetProcessHeap(), 0, sizeof(struct handle_table_entry)*newIEntries);
if (!newEntries)
return 0;
if (lpTable->paEntries)
{
memcpy(newEntries, lpTable->paEntries, sizeof(HANDLETABLEENTRY)*lpTable->iEntries);
memcpy(newEntries, lpTable->paEntries, sizeof(struct handle_table_entry)*lpTable->iEntries);
HeapFree(GetProcessHeap(), 0, lpTable->paEntries);
}
@ -259,7 +177,7 @@ static int grow_handle_table(HANDLETABLE *lpTable)
* non zero, if successful
* zero, if not successful (no free handle)
*/
static int alloc_handle(HANDLETABLE *lpTable, OBJECTHDR *lpObject, HCRYPTKEY *lpHandle)
static int alloc_handle(struct handle_table *lpTable, OBJECTHDR *lpObject, HCRYPTKEY *lpHandle)
{
int ret = 0;
@ -306,7 +224,7 @@ exit:
* non zero, if successful
* zero, if not successful (invalid handle)
*/
int release_handle(HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType)
int release_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType)
{
unsigned int index = HANDLE2INDEX(handle);
OBJECTHDR *pObject;
@ -351,7 +269,7 @@ exit:
* non zero, if successful
* zero, if not successful (invalid handle)
*/
int lookup_handle(HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject)
int lookup_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject)
{
int ret = 0;
@ -386,7 +304,7 @@ exit:
* non zero, if successful
* zero, if not successful (invalid handle or out of memory)
*/
int copy_handle(HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy)
int copy_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy)
{
OBJECTHDR *pObject;
int ret;
@ -429,7 +347,7 @@ int copy_handle(HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY
* INVALID_HANDLE_VALUE, if something went wrong.
* a handle to the new object, if successful.
*/
HCRYPTKEY new_object(HANDLETABLE *lpTable, size_t cbSize, DWORD dwType, DESTRUCTOR destructor,
HCRYPTKEY new_object(struct handle_table *lpTable, size_t cbSize, DWORD dwType, DESTRUCTOR destructor,
OBJECTHDR **ppObject)
{
OBJECTHDR *pObject;

View file

@ -42,34 +42,28 @@ struct tagOBJECTHDR
DESTRUCTOR destructor;
};
typedef struct tagHANDLETABLEENTRY
struct handle_table_entry
{
OBJECTHDR *pObject;
unsigned int iNextFree;
} HANDLETABLEENTRY;
};
/* Prevent conflict with wingdi.h */
#define tagHANDLETABLE tagHANDLETABLE_RSA
#define HANDLETABLE HANDLETABLE_RSA
typedef struct tagHANDLETABLE
struct handle_table
{
unsigned int iEntries;
unsigned int iFirstFree;
HANDLETABLEENTRY *paEntries;
struct handle_table_entry *paEntries;
CRITICAL_SECTION mutex;
} HANDLETABLE;
};
int alloc_handle_table (HANDLETABLE **lplpTable);
void init_handle_table (HANDLETABLE *lpTable);
int release_handle_table(HANDLETABLE *lpTable);
void destroy_handle_table(HANDLETABLE *lpTable);
int release_handle (HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType);
int copy_handle (HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy);
int lookup_handle (HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject);
int is_valid_handle (HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType);
void init_handle_table (struct handle_table *lpTable);
void destroy_handle_table(struct handle_table *lpTable);
int release_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType);
int copy_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy);
int lookup_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject);
int is_valid_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType);
HCRYPTKEY new_object (HANDLETABLE *lpTable, size_t cbSize, DWORD dwType, DESTRUCTOR destructor,
HCRYPTKEY new_object (struct handle_table *lpTable, size_t cbSize, DWORD dwType, DESTRUCTOR destructor,
OBJECTHDR **ppObject);
#ifdef __cplusplus

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -235,39 +235,20 @@ typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat);
/* error code to char* string */
char *mp_error_to_string(int code);
/* ---> init and deinit bignum functions <--- */
/* init a bignum */
int mp_init(mp_int *a);
/* free a bignum */
void mp_clear(mp_int *a);
/* init a null terminated series of arguments */
int mp_init_multi(mp_int *mp, ...);
/* clear a null terminated series of arguments */
void mp_clear_multi(mp_int *mp, ...);
/* exchange two ints */
void mp_exch(mp_int *a, mp_int *b);
/* shrink ram required for a bignum */
int mp_shrink(mp_int *a);
/* grow an int to a given size */
int mp_grow(mp_int *a, int size);
/* init to a given number of digits */
int mp_init_size(mp_int *a, int size);
/* ---> Basic Manipulations <--- */
#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
#define mp_iseven(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
#define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
/* set to zero */
void mp_zero(mp_int *a);
/* set to a digit */
void mp_set(mp_int *a, mp_digit b);
@ -294,30 +275,6 @@ void mp_clamp(mp_int *a);
/* ---> digit manipulation <--- */
/* right shift by "b" digits */
void mp_rshd(mp_int *a, int b);
/* left shift by "b" digits */
int mp_lshd(mp_int *a, int b);
/* c = a / 2**b */
int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d);
/* b = a/2 */
int mp_div_2(const mp_int *a, mp_int *b);
/* c = a * 2**b */
int mp_mul_2d(const mp_int *a, int b, mp_int *c);
/* b = a*2 */
int mp_mul_2(const mp_int *a, mp_int *b);
/* c = a mod 2**d */
int mp_mod_2d(const mp_int *a, int b, mp_int *c);
/* computes a = 2**b */
int mp_2expt(mp_int *a, int b);
/* Counts the number of lsbs which are zero before the first zero bit */
int mp_cnt_lsb(const mp_int *a);
@ -341,9 +298,6 @@ int mp_and(mp_int *a, mp_int *b, mp_int *c);
/* b = -a */
int mp_neg(mp_int *a, mp_int *b);
/* b = |a| */
int mp_abs(const mp_int *a, mp_int *b);
/* compare a to b */
int mp_cmp(const mp_int *a, const mp_int *b);
@ -362,9 +316,6 @@ int mp_mul(const mp_int *a, const mp_int *b, mp_int *c);
/* b = a*a */
int mp_sqr(const mp_int *a, mp_int *b);
/* a/b => cb + d == a */
int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d);
/* c = a mod b, 0 <= c < b */
int mp_mod(const mp_int *a, mp_int *b, mp_int *c);
@ -373,27 +324,15 @@ int mp_mod(const mp_int *a, mp_int *b, mp_int *c);
/* compare against a single digit */
int mp_cmp_d(const mp_int *a, mp_digit b);
/* c = a + b */
int mp_add_d(mp_int *a, mp_digit b, mp_int *c);
/* c = a - b */
int mp_sub_d(mp_int *a, mp_digit b, mp_int *c);
/* c = a * b */
int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c);
/* a/b => cb + d == a */
int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d);
/* a/3 => 3c + d == a */
int mp_div_3(mp_int *a, mp_int *c, mp_digit *d);
/* c = a**b */
int mp_expt_d(mp_int *a, mp_digit b, mp_int *c);
/* c = a mod b, 0 <= c < b */
int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c);
/* ---> number theory <--- */
/* d = a + b (mod c) */
@ -459,12 +398,6 @@ int mp_montgomery_reduce(mp_int *a, const mp_int *m, mp_digit mp);
/* returns 1 if a is a valid DR modulus */
int mp_dr_is_modulus(mp_int *a);
/* sets the value of "d" required for mp_dr_reduce */
void mp_dr_setup(const mp_int *a, mp_digit *d);
/* reduces a modulo b using the Diminished Radix method */
int mp_dr_reduce(mp_int *a, const mp_int *b, mp_digit mp);
/* returns true if a can be reduced with mp_reduce_2k */
int mp_reduce_is_2k(mp_int *a);
@ -482,33 +415,16 @@ int mp_exptmod(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d);
/* number of primes */
#define PRIME_SIZE 256
/* result=1 if a is divisible by one of the first PRIME_SIZE primes */
int mp_prime_is_divisible(const mp_int *a, int *result);
/* performs one Fermat test of "a" using base "b".
* Sets result to 0 if composite or 1 if probable prime
*/
int mp_prime_fermat(mp_int *a, mp_int *b, int *result);
/* performs one Miller-Rabin test of "a" using base "b".
* Sets result to 0 if composite or 1 if probable prime
*/
int mp_prime_miller_rabin(mp_int *a, const mp_int *b, int *result);
/* This gives [for a given bit size] the number of trials required
* such that Miller-Rabin gives a prob of failure lower than 2^-96
*/
int mp_prime_rabin_miller_trials(int size);
/* performs t rounds of Miller-Rabin on "a" using the first
* t prime bases. Also performs an initial sieve of trial
* division. Determines if "a" is prime with probability
* of error no more than (1/4)**t.
*
* Sets result to 1 if probably prime, 0 otherwise
*/
int mp_prime_is_prime(mp_int *a, int t, int *result);
/* finds the next prime after the number "a" using "t" trials
* of Miller-Rabin.
*

View file

@ -868,9 +868,26 @@ static HRESULT WINAPI WBOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
{
WebBrowser *This = OLECMD_THIS(iface);
FIXME("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
IOleCommandTarget *cmdtrg;
HRESULT hres;
TRACE("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
pCmdText);
return E_NOTIMPL;
if(!This->doc_host.document)
return 0x80040104;
/* NOTE: There are probably some commands that we should handle here
* instead of forwarding to document object. */
hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (void**)&cmdtrg);
if(FAILED(hres))
return hres;
hres = IOleCommandTarget_QueryStatus(cmdtrg, pguidCmdGroup, cCmds, prgCmds, pCmdText);
IOleCommandTarget_Release(cmdtrg);
return hres;
}
static HRESULT WINAPI WBOleCommandTarget_Exec(IOleCommandTarget *iface,

View file

@ -46,4 +46,5 @@
#include "shlwapi_Sk.rc"
#include "shlwapi_Sv.rc"
#include "shlwapi_Tr.rc"
#include "shlwapi_Uk.rc"#include "shlwapi_Zh.rc"
#include "shlwapi_Uk.rc"
#include "shlwapi_Zh.rc"