123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #define _CRT_SECURE_NO_WARNINGS
- #include <windows.h>
- #include <stdio.h>
- #define PATH L"DLLWin.dll"
- #include "../structs.h"
- typedef ResultUserAndCount(_cdecl* MyFunction)(FILE*);
- int main() {
- HINSTANCE hMyDll;
- if ((hMyDll = LoadLibrary(PATH)) == NULL) return 1;
- MyFunction myFun = (MyFunction)GetProcAddress(hMyDll, "GetFirstAndCounter");
-
- FILE* FileHandle = fopen("ds.csv", "r");
- /*wchar_t* buffer = (wchar_t*)malloc(sizeof(wchar_t) * 100);
- DWORD count_buff = 100;
- DWORD count_char = 0;
- while (fscanf(FileHandle, "%s", buffer) == 1) {
- MessageBox(NULL, buffer, L"Îøèáêà", MB_ICONERROR);
- printf("%s", buffer);
- }*/
- /* CreateFileW(
- L"ds.csv",
- GENERIC_READ,
- FILE_SHARE_READ,
- NULL,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- 0
- );*/
- if (FileHandle == INVALID_HANDLE_VALUE) {
- int error = GetLastError();
- }
- ResultUserAndCount result = myFun(FileHandle);
- char* buf = (char*)malloc(sizeof(char) * 100);
- snprintf(buf, sizeof buf, "%d", result.count_users);
- printf("%s", buf);
- FreeLibrary(hMyDll);
- return 0;
- }
|