Skip to content

Commit

Permalink
External wallet config (nodevfeeWallet.txt).
Browse files Browse the repository at this point in the history
  • Loading branch information
Demion committed Nov 1, 2017
1 parent ca71523 commit 8e63669
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions nodevfeeDll/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bool Initial = true;

char Wallet[42] = {0};

FILE *File = 0;
FILE *LogFile = 0, *WalletFile = 0;

int (__stdcall *sendOriginal)(SOCKET s, const char *buf, int len, int flags);

Expand Down Expand Up @@ -48,30 +48,40 @@ int __stdcall sendHook(SOCKET s, const char *buf, int len, int flags)
printf("NoDevFee: eth_login -> %s\n", Wallet);
}

if (File)
if (LogFile)
{
fprintf(File, "s = 0x%04X flags = 0x%04X len = %4d buf = ", (unsigned int) s, flags, len);
fprintf(LogFile, "s = 0x%04X flags = 0x%04X len = %4d buf = ", (unsigned int) s, flags, len);

for (int i = 0; i < len; ++i)
fprintf(File, "%02X ", buf[i]);
fprintf(LogFile, "%02X ", buf[i]);

fprintf(File, "\n%s\n", buf);
fprintf(LogFile, "\n%s\n", buf);

fflush(File);
fflush(LogFile);
}

return sendOriginal(s, buf, len, flags);
}

static void Hook()
{
File = fopen("nodevfeeLog.txt", "r");
LogFile = fopen("nodevfeeLog.txt", "r");

if (File)
if (LogFile)
{
fclose(File);
fclose(LogFile);

File = fopen("nodevfeeLog.txt", "w");
LogFile = fopen("nodevfeeLog.txt", "w");
}

WalletFile = fopen("nodevfeeWallet.txt", "r");

if (WalletFile)
{
if (fread(Wallet, 1, 42, WalletFile) == 42)
Initial = false;

fclose(WalletFile);
}

MH_STATUS result = MH_UNKNOWN;
Expand Down

0 comments on commit 8e63669

Please # to comment.