Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <curl/curl.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- SIZE_T write_data(void* ptr, SIZE_T size, SIZE_T nmemb, FILE* stream) {
- SIZE_T written = fwrite(ptr, size, nmemb, stream);
- return written;
- }
- int downloadFile(const char* url, const char* outfilename) {
- CURL* curl;
- FILE* fp;
- CURLcode res;
- curl = curl_easy_init();
- if (curl) {
- fp = fopen(outfilename, "wb");
- curl_easy_setopt(curl, CURLOPT_URL, url);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
- res = curl_easy_perform(curl);
- /* always cleanup */
- curl_easy_cleanup(curl);
- fclose(fp);
- }
- return 0;
- }
- char* deblank(char* input)
- {
- int i, j;
- char* output = input;
- for (i = 0, j = 0; i < strlen(input); i++, j++)
- {
- if (input[i] != ' ')
- output[j] = input[i];
- else
- j--;
- }
- output[j] = 0;
- return output;
- }
- void dumpToFile(char* input)
- {
- FILE* fPtr;
- fPtr = fopen("test/test.txt", "w");
- fputs(input, fPtr);
- fclose(fPtr);
- }
- /*_declspec(dllexport) void checkActualisation() {
- char temppath[510] = " ";
- int tpathlength = GetTempPath(255, temppath);
- char tempfile[520] = " ";
- int tfilelength = GetTempFileName(deblank(temppath), "verze460_", 0, tempfile);
- downloadFile("https://jachyhm.cz/verze460.txt", deblank(tempfile));
- dumpToFile(tempfile);
- }*/
- _declspec(dllexport) void openDoors() {
- keybd_event(0x54, 0, 0, 0);
- keybd_event(0x54, 0, KEYEVENTF_KEYUP, 0);
- }
- BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved)
- {
- switch (dwReason) {
- case DLL_PROCESS_ATTACH:
- break;
- case DLL_PROCESS_DETACH:
- system("notepad.exe");
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- break;
- }
- return TRUE;
- }
- #ifdef __cplusplus
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement