Implemented DosDateTimeToVariant() and SysAllocStringByteLen() functions.
This commit is contained in:
parent
6d40d1b05f
commit
986de4b12a
|
@ -326,6 +326,58 @@ INT WINAPI OleTranslateColor(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* SysAllocStringByteLen [OLEAUT32.150]
|
||||
*
|
||||
*/
|
||||
BSTR WINAPI SysAllocStringByteLen(char *in, int len)
|
||||
{
|
||||
DWORD* newBuffer;
|
||||
char* stringBuffer;
|
||||
|
||||
/*
|
||||
* Allocate a new buffer to hold the string.
|
||||
* dont't forget to keep an empty spot at the begining of the
|
||||
* buffer for the character count and an extra character at the
|
||||
* end for the NULL.
|
||||
*/
|
||||
newBuffer = (DWORD*)HeapAlloc(GetProcessHeap(),
|
||||
0,
|
||||
len + sizeof(WCHAR) + sizeof(DWORD));
|
||||
|
||||
/*
|
||||
* If the memory allocation failed, return a null pointer.
|
||||
*/
|
||||
if (newBuffer==0)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Copy the length of the string in the placeholder.
|
||||
*/
|
||||
*newBuffer = len;
|
||||
|
||||
/*
|
||||
* Skip the byte count.
|
||||
*/
|
||||
newBuffer++;
|
||||
|
||||
/*
|
||||
* Copy the information in the buffer.
|
||||
* Since it is valid to pass a NULL pointer here, we'll initialize the
|
||||
* buffer to nul if it is the case.
|
||||
*/
|
||||
if (in != 0)
|
||||
memcpy(newBuffer, in, len);
|
||||
|
||||
/*
|
||||
* Make sure that there is a nul character at the end of the
|
||||
* string.
|
||||
*/
|
||||
stringBuffer = (char *)newBuffer;
|
||||
stringBuffer[len] = 0;
|
||||
stringBuffer[len+1] = 0;
|
||||
|
||||
return (LPWSTR)stringBuffer;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4237,3 +4237,28 @@ HRESULT WINAPI VarCyFromUI4(ULONG ulIn, CY* pcyOut) {
|
|||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* DosDateTimeToVariantTime [OLEAUT32.14]
|
||||
* Convert dos representation of time to the date and time representation
|
||||
* stored in a variant.
|
||||
*/
|
||||
INT WINAPI DosDateTimeToVariantTime(USHORT wDosDate, USHORT wDosTime,
|
||||
DATE *pvtime)
|
||||
{
|
||||
struct tm t;
|
||||
|
||||
TRACE( ole, "( 0x%x, 0x%x, 0x%p ), stub\n", wDosDate, wDosTime, pvtime );
|
||||
|
||||
t.tm_sec = (wDosTime & 0x001f) * 2;
|
||||
t.tm_min = (wDosTime & 0x07e0) >> 5;
|
||||
t.tm_hour = (wDosTime & 0xf800) >> 11;
|
||||
|
||||
t.tm_mday = (wDosDate & 0x001f);
|
||||
t.tm_mon = (wDosDate & 0x01e0) >> 5;
|
||||
t.tm_year = ((wDosDate & 0xfe00) >> 9) + 1980;
|
||||
|
||||
return TmToDATE( &t, pvtime );
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ type win32
|
|||
11 stdcall VariantCopyInd(ptr ptr) VariantCopyInd
|
||||
12 stdcall VariantChangeType(ptr ptr) VariantChangeType
|
||||
13 stub VariantTimeToDosDateTime
|
||||
14 stub DosDateTimeToVariantTime
|
||||
14 stdcall DosDateTimeToVariantTime(long ptr) DosDateTimeToVariantTime
|
||||
15 stdcall SafeArrayCreate(long long ptr) SafeArrayCreate
|
||||
16 stdcall SafeArrayDestroy(ptr) SafeArrayDestroy
|
||||
17 stdcall SafeArrayGetDim(ptr) SafeArrayGetDim
|
||||
|
@ -129,7 +129,7 @@ type win32
|
|||
147 stdcall VariantChangeTypeEx(ptr ptr) VariantChangeTypeEx
|
||||
148 stub SafeArrayPtrOfIndex
|
||||
149 stdcall SysStringByteLen(ptr) SysStringByteLen
|
||||
150 stub SysAllocStringByteLen
|
||||
150 stdcall SysAllocStringByteLen(ptr long) SysAllocStringByteLen
|
||||
160 stub CreateTypeLib
|
||||
161 stdcall LoadTypeLib (ptr ptr) LoadTypeLib
|
||||
162 stdcall LoadRegTypeLib (ptr long long long ptr) LoadRegTypeLib
|
||||
|
|
Loading…
Reference in New Issue