1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
|
" codeBody "
STDMETHODIMP FileStore:: WriteData (fileName BSTR, Bstr- gegevens)
{
CComBSTR filePath = store_path;
filePath.Append (fileName);
hFile HANDVAT =:: CreateFile (filePath, GENERIC_WRITE | GENERIC_READ, ONGELDIGE FILE_SHARE_WRITE, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, VERKLAAR) NIETIG;
DWORD dwBytesWritten = 0;
DWORD dwFileSize;
TCHAR* pszUnicodeBuff;
dwFileSize = wcslen (gegevens);
pszUnicodeBuff = (TCHAR*) LocalAlloc (LPTR, (dwFileSize +1) * sizeof (TCHAR));
_tcsncpy (pszUnicodeBuff, dwFileSize de gegevens,);
:: hFile WriteFile (, (LPCVOID) pszUnicodeBuff, (dwFileSize +1) * sizeof (TCHAR), &dwBytesWritten, VERKLAAR nietig);
:: (hFile) CloseHandle;
terugkeer S_OK;
}
//-------------------------------------------------
STDMETHODIMP FileStore:: ReadData (fileName BSTR, Bstr*- gegevens)
{
DWORD dwBytesWritten = 0;
DWORD dwFileSize;
CHAR* pszFileBuff = 0;
TCHAR* pszUnicodeBuff;
CComBSTR filePath = store_path;
filePath.Append (fileName);
hFile HANDVAT = CreateFile (filePath, GENERIC_READ | GENERIC_READ, FILE_SHARE_READ | ONGELDIG FILE_SHARE_WRITE, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, VERKLAAR) NIETIG;
dwFileSize = GetFileSize (hFile, ONGELDIG);
pszFileBuff = (char*) LocalAlloc (LPTR, dwFileSize);
hFile ReadFile (, (LPVOID) pszFileBuff, dwFileSize, &dwBytesWritten, VERKLAAR nietig);
pszUnicodeBuff = (TCHAR*) LocalAlloc (LPTR, sizeof (TCHAR) * (dwFileSize + 1));
mbstowcs (pszUnicodeBuff, (const klusje *) pszFileBuff, (size_t) strlen (pszFileBuff));
(hFile) CloseHandle;
terugkeer SysReAllocString (gegevens, pszUnicodeBuff);
}
|