Skip to content

Commit

Permalink
Merge pull request #140 from K-Society/experimental
Browse files Browse the repository at this point in the history
Experimental
  • Loading branch information
maniglia authored May 14, 2024
2 parents 7762bc3 + 21fb56a commit 7e261e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions src/01/Programmer/dllmain.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"

const wchar_t* loaderPath = L"..\\..\\st\\Programmer";
const wchar_t* loaderPath = L"st\\Programmer";

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
Expand All @@ -12,6 +12,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,

WCHAR dllName[MAX_PATH + 1];
DWORD size = 0;
int result = 0;

switch (ul_reason_for_call)
{
Expand All @@ -21,8 +22,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
if (size > 0)
{
std::wstring dllNameStr(dllName);

std::size_t pos = dllNameStr.size() - 14;
std::size_t pos = dllNameStr.size() - 22;
dllNameStr = dllNameStr.substr(0, pos);
dllNameStr += loaderPath;
std::replace(dllNameStr.begin(), dllNameStr.end(), '\\', '/');
Expand All @@ -35,12 +35,13 @@ BOOL APIENTRY DllMain( HMODULE hModule,
size_t convertedSize;
wcstombs_s(&convertedSize, buffer, bufferSize, input, bufferSize);

/* Set device loaders path that contains FlashLoader and ExternalLoader folders*/
// Set device loaders path that contains FlashLoader and ExternalLoader folders.
SetLoadersPath(buffer);

delete[] buffer;

result = 1;
}

break;

case DLL_THREAD_ATTACH:
Expand All @@ -53,5 +54,10 @@ BOOL APIENTRY DllMain( HMODULE hModule,
break;
}

return TRUE;
if (result == 1)
{
return TRUE;
}

return FALSE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ int main()
//s += std::wstring(ws2);

std::wstring s(dllName);
std::size_t pos = s.size() - 32;
std::size_t pos = s.size() - 40;
s = s.substr(0, pos);
s += wide;

Expand Down

0 comments on commit 7e261e6

Please sign in to comment.