// Project: XorLib - Xor Encryption Libary.
// Copyright: Copyright © 2009-2010 Shadowscape Studios. All Rights Reserved.
// Developer: Shadowscape Studios
// Website: http://www.shadowscape.co.uk
// Support: support@shadowscape.co.uk
// Version: 1.0.0.0
// Release: 151220102240
#define export __declspec (dllexport)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
long filesize(FILE *f)
{
long fs;
fseek(f,0L,SEEK_END);
fs = ftell(f);
fseek(f,0L,SEEK_SET);
return fs;
}
export double xorcrypt(char *rn, char *wn, char *sb, double ss)
{
FILE *rf, *wf;
unsigned char fb[BUFSIZ];
unsigned int bp, sp = 0;
size_t bs;
if ((rf = fopen(rn,"rb")) == NULL) { return 0; }
if ((wf = fopen(wn,"wb")) == NULL) { return 0; }
while ((bs = fread(fb, 1, BUFSIZ, rf)) != 0)
{
for ( bp = 0; bp < bs; ++bp )
{
fb[bp] ^= sb[sp++];
if ( sp == ss )
{
sp = 0;
}
}
fwrite(fb, 1, bs, wf);
}
fclose(wf);
fclose(rf);
return 1;
}
export double xorcryptf(char *fn, char *tn, char *sn)
{
FILE *f;
char *sb;
double ss, r;
if ((f = fopen(sn,"rb")) == NULL) return 0;
ss = filesize(f);
if ((sb = (char *) malloc(sizeof(char) * ss)) == NULL) return 0;
fread(sb,ss,1,f);
fclose(f);
r = xorcrypt(fn,tn,sb,ss);
free(sb);
return r;
}
export double xorcrypto(char *fn, char *sb, double ss)
{
FILE *f;
unsigned char fb[BUFSIZ];
unsigned int bp, sp = 0;
long rp, wp;
size_t bs;
if ((f = fopen(fn,"rb+")) == NULL)
{
return 0;
}
rp = wp = ftell(f);
while ((bs = fread(fb, 1, BUFSIZ, f)) != 0)
{
rp = ftell(f);
for ( bp = 0; bp < bs; ++bp )
{
fb[bp] ^= sb[sp++];
if ( sp == ss )
{
sp = 0;
}
}
fseek(f,wp,SEEK_SET);
fwrite(fb, 1, bs, f);
fflush(f);
wp = ftell(f);
fseek(f,rp,SEEK_SET);
}
fclose(f);
return 1;
}
export double xorcryptof(char *fn, char *sn)
{
FILE *f;
char *sb;
double ss, r;
if ((f = fopen(sn,"rb")) == NULL); return 0;
ss = filesize(f);
if ((sb = (char *) malloc(sizeof(char) * ss)) == NULL) return 0;
fread(sb,ss,1,f);
fclose(f);
r = xorcrypto(fn,sb,ss);
free(sb);
return r;
}
hi i have made this dll and was wondering how would i write the functions in devc++ for the ".h" file because i have been informed i need to do that as it just seems to crash the application at the moment and im new to this language so im very unsure how they should look and all i have for refrence is the following which doesnt really seem to help so much as my functions seem diffrent to this. it would be amazing if someone could help me its taken me months to get this far and i am so determined to get this out to developers soon as i think it could prove useful to have.
#ifndef _DLL_H_
#define _DLL_H_
#include <windows.h>
#ifndef DLL_EXPORT
#define DLL_EXPORT extern "C" __declspec(dllexport)
#endif
DLL_EXPORT void SayHello();
DLL_EXPORT int Addition(int arg1,int arg2);
DLL_EXPORT LPTSTR CombineString(LPTSTR arg1,LPTSTR arg2);
#endif