For reference for others:
Code:
#include "stdafx.h"
#include <stdio.h> // for namespace
#include <valarray> // for Xor
#include <string>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
char outvalue[2] = "";
char out [2] = "";
__declspec(dllexport) LPCTSTR ecc(LPCTSTR invalue)
{
unsigned int v=0;
unsigned int vlen=0;
// Setup Values of Variables
vlen = strlen(invalue);
outvalue[0] = invalue[0];
// Loop
for(v;v<vlen-1;v++)
{
outvalue [0] ^= invalue[v+1];
}
sprintf(out, "%X",2, outvalue[0]);
return out;
}
As a first suggestion, I'd like to advise to get rid of LPCTSTR and the like. In your functions, use appropriate type.
The function should take const char* and return char*. OK? Good.
Then you will need to allocate a buffer large enough to hold the new data via new.
Then you simply assign the XORed data to your new buffer and return it.
Start with that.