Commit fc2be7ed authored by Patrik Stridvall's avatar Patrik Stridvall Committed by Alexandre Julliard

Fixed some issues found by winapi_check.

parent c56ed505
......@@ -17,12 +17,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
///////////////////////
//
// TODO:
// - Reference counting
// - Thread-safing
// - Signature checking
/***********************************************************************
*
* TODO:
* - Reference counting
* - Thread-safing
* - Signature checking
*/
#include <time.h>
#include <stdlib.h>
......@@ -140,7 +141,7 @@ static inline BOOL CRYPT_ANSIToUnicode(LPCSTR str, LPWSTR* wstr, int wstrsize)
return FALSE;
}
//These next 2 functions are used by the VTableProvStruc structure
/* These next 2 functions are used by the VTableProvStruc structure */
BOOL CRYPT_VerifyImage(LPCSTR lpszImage, BYTE* pData)
{
if (!lpszImage || !pData)
......@@ -148,7 +149,7 @@ BOOL CRYPT_VerifyImage(LPCSTR lpszImage, BYTE* pData)
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
//FIXME: Actually verify the image!
/* FIXME: Actually verify the image! */
return TRUE;
}
......@@ -205,8 +206,9 @@ PCRYPTPROV CRYPT_LoadProvider(PSTR pImage)
CRYPT_GetProvFunc(CPSignHash);
CRYPT_GetProvFunc(CPVerifySignature);
//FIXME: Not sure what the pbContextInfo field is for
// Does it need memory allocation?
/* FIXME: Not sure what the pbContextInfo field is for.
* Does it need memory allocation?
*/
provider->pVTable->Version = 3;
provider->pVTable->pFuncVerifyImage = CRYPT_VerifyImage;
provider->pVTable->pFuncReturnhWnd = CRYPT_ReturnhWnd;
......@@ -251,8 +253,10 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
PCRYPTPROV pProv = NULL;
HKEY key;
PSTR imagepath = NULL, keyname = NULL, provname = NULL, temp = NULL;
// BYTE* signature;
DWORD keytype, type, len;//, siglen;
#if 0
BYTE* signature;
#endif
DWORD keytype, type, len;
TRACE("(%p, %s, %s, %ld, %08lx)\n", phProv, pszContainer,
pszProvider, dwProvType, dwFlags);
......@@ -270,8 +274,9 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
if (!pszProvider)
{
//No CSP name specified so try the user default CSP first
// then try the machine default CSP
/* No CSP name specified so try the user default CSP first
* then try the machine default CSP
*/
if ( !(keyname = CRYPT_GetTypeKeyName(dwProvType, TRUE)) )
CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY);
if (RegOpenKeyA(HKEY_CURRENT_USER, keyname, &key))
......@@ -316,7 +321,9 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
}
if (!ExpandEnvironmentStringsA(temp, imagepath, len)) goto error;
// if (!CRYPT_VerifyImage(imagepath, signature)) goto error;
#if 0
if (!CRYPT_VerifyImage(imagepath, signature)) goto error;
#endif
pProv = CRYPT_LoadProvider(imagepath);
CRYPT_Free(temp);
CRYPT_Free(imagepath);
......@@ -324,9 +331,10 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
if (pProv->pFuncs->pCPAcquireContext(&pProv->hPrivate, (CHAR*)pszContainer, dwFlags, pProv->pVTable))
{
//MSDN: When this flag is set, the value returned in phProv is undefined,
// and thus, the CryptReleaseContext function need not be called afterwards.
//Therefore, we must clean up everything now.
/* MSDN: When this flag is set, the value returned in phProv is undefined,
* and thus, the CryptReleaseContext function need not be called afterwards.
* Therefore, we must clean up everything now.
*/
if (dwFlags & CRYPT_DELETEKEYSET)
{
FreeLibrary(pProv->hModule);
......@@ -340,7 +348,7 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
}
return TRUE;
}
//FALLTHROUGH TO ERROR IF FALSE - CSP internal error!
/* FALLTHROUGH TO ERROR IF FALSE - CSP internal error! */
error:
if (pProv)
{
......@@ -393,7 +401,7 @@ BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFl
{
FIXME("(0x%lx, %p, %08lx): stub!\n", hProv, pdwReserved, dwFlags);
return FALSE;
//InterlockIncrement??
/* InterlockIncrement?? */
}
/******************************************************************************
......@@ -411,10 +419,12 @@ BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags)
SetLastError(NTE_BAD_UID);
return FALSE;
}
//FIXME: Decrement the counter here first if possible
/* FIXME: Decrement the counter here first if possible */
ret = pProv->pFuncs->pCPReleaseContext(pProv->hPrivate, dwFlags);
FreeLibrary(pProv->hModule);
// CRYPT_Free(pProv->pVTable->pContextInfo);
#if 0
CRYPT_Free(pProv->pVTable->pContextInfo);
#endif
CRYPT_Free(pProv->pVTable->pszProvName);
CRYPT_Free(pProv->pVTable);
CRYPT_Free(pProv->pFuncs);
......@@ -465,7 +475,7 @@ BOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
key ? key->hPrivate : 0, 0, &hash->hPrivate))
return TRUE;
//CSP error!
/* CSP error! */
CRYPT_Free(hash);
return FALSE;
}
......@@ -513,7 +523,7 @@ BOOL WINAPI CryptDeriveKey (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData
if (prov->pFuncs->pCPDeriveKey(prov->hPrivate, Algid, hash->hPrivate, dwFlags, &key->hPrivate))
return TRUE;
//CSP error!
/* CSP error! */
CRYPT_Free(key);
return FALSE;
}
......@@ -688,7 +698,7 @@ BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved,
{
PSTR str = NULL;
DWORD strlen;
BOOL ret;// = FALSE;
BOOL ret; /* = FALSE; */
TRACE("(%ld, %p, %08ld, %p, %p, %p)\n", dwIndex, pdwReserved, dwFlags,
pdwProvType, pszProvName, pcbProvName);
......@@ -736,7 +746,7 @@ BOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved,
return FALSE;
RegOpenKeyA(hKey, keyname, &hSubkey);
ch = keyname + strlen(keyname);
//Convert "Type 000" to 0, etc/
/* Convert "Type 000" to 0, etc/ */
*pdwProvType = *(--ch) - '0';
*pdwProvType += (*(--ch) - '0') * 10;
*pdwProvType += (*(--ch) - '0') * 100;
......@@ -814,7 +824,7 @@ BOOL WINAPI CryptGenKey (HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKE
if (prov->pFuncs->pCPGenKey(prov->hPrivate, Algid, dwFlags, &key->hPrivate))
return TRUE;
//CSP error!
/* CSP error! */
CRYPT_Free(key);
return FALSE;
}
......@@ -951,7 +961,7 @@ BOOL WINAPI CryptGetUserKey (HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUse
if (prov->pFuncs->pCPGetUserKey(prov->hPrivate, dwKeySpec, &key->hPrivate))
return TRUE;
//CSP Error
/* CSP Error */
CRYPT_Free(key);
return FALSE;
}
......@@ -1188,8 +1198,8 @@ BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DW
}
if (dwFlags & PP_CLIENT_HWND)
{
//FIXME: Should verify the parameter
if (pbData /*&& IsWindow((HWND)pbData)*/)
/* FIXME: Should verify the parameter */
if (pbData /* && IsWindow((HWND)pbData) */)
{
crypt_hWindow = (HWND)(pbData);
return TRUE;
......@@ -1198,7 +1208,7 @@ BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DW
return FALSE;
}
}
//All other flags go to the CSP
/* All other flags go to the CSP */
return prov->pFuncs->pCPSetProvParam(prov->hPrivate, dwParam, pbData, dwFlags);
}
......
......@@ -2965,7 +2965,7 @@ _write_bitmap(HBITMAP hBitmap, LPSTREAM pstm, int cx, int cy)
bmih->biHeight = nheight;
if(bitCount == 1) {
//Hack.
/* Hack. */
LPBITMAPINFO inf = (LPBITMAPINFO)bmih;
inf->bmiColors[0].rgbRed = inf->bmiColors[0].rgbGreen = inf->bmiColors[0].rgbBlue = 0;
inf->bmiColors[1].rgbRed = inf->bmiColors[1].rgbGreen = inf->bmiColors[1].rgbBlue = 0xff;
......
......@@ -953,7 +953,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
TBADDBITMAP tba[] =
{
{ HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR },
{ COMDLG32_hInstance, 800 } // desktop icon
{ COMDLG32_hInstance, 800 } /* desktop icon */
};
RECT rectTB;
......
......@@ -168,7 +168,7 @@ debug_channels ()
@ stub CryptVerifyMessageSignatureWithKey
@ stub CryptVerifySignatureU
@ stub I_CryptAllocTls
@ stdcall I_CryptCreateLruCache(long) I_CryptCreateLruCache
@ stdcall I_CryptCreateLruCache(long long) I_CryptCreateLruCache
@ stub I_CryptCreateLruEntry
@ stub I_CryptDetachTls
@ stdcall I_CryptFindLruEntryData(long) I_CryptFindLruEntryData
......
......@@ -569,6 +569,7 @@ static int FreePrintJob(HANDLE16 hJob)
/**********************************************************************
* OpenJob (GDI.240)
* OpenJob16 (GDI32.@)
*
*/
HPJOB16 WINAPI OpenJob16(LPCSTR lpOutput, LPCSTR lpTitle, HDC16 hDC)
......@@ -615,6 +616,7 @@ HPJOB16 WINAPI OpenJob16(LPCSTR lpOutput, LPCSTR lpTitle, HDC16 hDC)
/**********************************************************************
* CloseJob (GDI.243)
* CloseJob16 (GDI32.@)
*
*/
INT16 WINAPI CloseJob16(HPJOB16 hJob)
......@@ -637,6 +639,7 @@ INT16 WINAPI CloseJob16(HPJOB16 hJob)
/**********************************************************************
* WriteSpool (GDI.241)
* WriteSpool16 (GDI32.@)
*
*/
INT16 WINAPI WriteSpool16(HPJOB16 hJob, LPSTR lpData, INT16 cch)
......@@ -784,7 +787,8 @@ LPBYTE lpPrinterData, int cbData, int what)
}
/******************************************************************
* DrvGetPrinterData [GDI.282]
* DrvGetPrinterData (GDI.282)
* DrvGetPrinterData16 (GDI32.@)
*
*/
DWORD WINAPI DrvGetPrinterData16(LPSTR lpPrinter, LPSTR lpProfile,
......@@ -878,7 +882,8 @@ failed:
/******************************************************************
* DrvSetPrinterData [GDI.281]
* DrvSetPrinterData (GDI.281)
* DrvSetPrinterData16 (GDI32.@)
*
*/
DWORD WINAPI DrvSetPrinterData16(LPSTR lpPrinter, LPSTR lpProfile,
......
......@@ -1341,8 +1341,10 @@ int _write(int fd, const void* buf, unsigned int count)
HANDLE hand = msvcrt_fdtoh(fd);
/* Dont trace small writes, it gets *very* annoying */
// if (count > 32)
// TRACE(":fd (%d) handle (%d) buf (%p) len (%d)\n",fd,hand,buf,count);
#if 0
if (count > 32)
TRACE(":fd (%d) handle (%d) buf (%p) len (%d)\n",fd,hand,buf,count);
#endif
if (hand == INVALID_HANDLE_VALUE)
return -1;
......
......@@ -758,7 +758,7 @@ VOID RICHED32_Register(void)
wndClass.cbWndExtra = 0; /*(sizeof(RICHED32_INFO *);*/
wndClass.hCursor = LoadCursorA(0, IDC_ARROWA);
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszClassName = RICHEDIT_CLASS10A;//WC_RICHED32A;
wndClass.lpszClassName = RICHEDIT_CLASS10A; /* WC_RICHED32A; */
RegisterClassA (&wndClass);
}
......
......@@ -55,7 +55,9 @@ typedef struct tagPOLICYDAT
DWORD cache; /* cached value or 0xffffffff for invalid */
} POLICYDATA, *LPPOLICYDATA;
//extern POLICYDATA sh32_policy_table[SHELL_MAX_POLICIES];
#if 0
extern POLICYDATA sh32_policy_table[SHELL_MAX_POLICIES];
#endif
/* application strings */
......
......@@ -247,7 +247,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
if (NULL != lpszReferrer && strlen(lpszReferrer))
HTTP_ProcessHeader(lpwhr, HTTP_REFERER, lpszReferrer, HTTP_ADDHDR_FLAG_COALESCE);
//! FIXME
/* FIXME */
if (NULL != lpszAcceptTypes && strlen(*lpszAcceptTypes))
HTTP_ProcessHeader(lpwhr, HTTP_ACCEPT, *lpszAcceptTypes, HTTP_ADDHDR_FLAG_COALESCE);
......@@ -459,7 +459,7 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel,
}
else
{
//! Copy strncpy(lpBuffer, lphttpHdr[*lpdwIndex], len);
/* Copy strncpy(lpBuffer, lphttpHdr[*lpdwIndex], len); */
(*lpdwIndex)++;
}
}
......@@ -1167,7 +1167,7 @@ BOOL HTTP_ProcessHeader(LPWININETHTTPREQA lpwhr, LPCSTR field, LPCSTR value, DWO
if (len <= 0)
{
//! if custom header delete from array
/* if custom header delete from array */
HeapFree(GetProcessHeap(), 0, lphttpHdr->lpszValue);
lphttpHdr->lpszValue = NULL;
bSuccess = TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment