Let us start here, from square one. No, from Zero!

This commit is contained in:
smpn2
2022-09-30 22:45:51 +09:00
parent 14215af0d1
commit b7a60638a4
1005 changed files with 303069 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#include "resutils.h"
#include "util/utils.h"
const char *resutil::load_file(int name, LPCSTR type, DWORD *size) {
HMODULE handle = GetModuleHandle(NULL);
HRSRC rc = FindResource(handle, MAKEINTRESOURCE(name), type);
HGLOBAL rcData = LoadResource(handle, rc);
if (size != nullptr)
*size = SizeofResource(handle, rc);
return static_cast<const char*>(LockResource(rcData));
}
std::string resutil::load_file_string(int name, LPCSTR type) {
DWORD size = 0;
auto data = resutil::load_file(name, type, &size);
return std::string(data, size);
}
std::string resutil::load_file_string_crlf(int name, LPCSTR type) {
std::string s = load_file_string(name, type);
strreplace(s, "\n", "\r\n");
return s;
}