File Operation Changes -sp1 to sp2?
From: Drew Gilkey and Roy Mayhall (Mayhall_at_discussions.microsoft.com)
Date: 01/15/05
- Next message: bobby: "Re: Question about cli and win2000"
- Previous message: Gabriel Bogdan: "Re: Shared memory delay"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 15 Jan 2005 15:07:02 -0800
Hey guys, been working on an encryption program, in C++, and have ran into
some checksum errors when going between XP SP2 to SP1 and vice versa. Pretty
much when the file is encrypted and I move the same file to a machine running
a different the other SP it will not decrypt. We are sure it is something
with my IO related code and was wondering if there has been any changes
between the service packs that would effect the following:
#include <bitset>
#include <string>
XOR
_lrotr
_lrotl
Any MFC related changes listed below.
Here are also some code snippets of how I am inputing and outputing the file:
// Attempt to open the input file
infile = CreateFile(filein.c_str(),GENERIC_READ,FILE_SHARE_READ,NULL,
OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,NULL);
if (infile == INVALID_HANDLE_VALUE)
{
istate = open_failed;
return false;
}
// Determine the length of the input file
unsigned long pos = 0,size;
size = GetFileSize(infile,NULL);
if (size == 0xFFFFFFFF)
{
istate = io_error;
CloseHandle(infile);
return false;
}
// Attempt to create a new file for output
outfile = CreateFile(fileout.c_str(),GENERIC_WRITE,FILE_SHARE_READ,NULL,
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,NULL);
if (outfile == INVALID_HANDLE_VALUE)
{
CloseHandle(infile);
ostate = open_failed;
return false;
}
// readBlock() member function
// Retrieves a large amount of data from the input file to a buffer, to be
processed by
// SYNCLAIR.
__inline bool synclair::readBlock()
{
blockpos = 0;
int status = ReadFile(infile,filebuffer,MAX_SIZE,&numread,NULL);
return status!=0;
}
// writeBlock() member function
// Writes the contents of the file buffer to the output file.
__inline bool synclair::writeBlock()
{
unsigned long numwritten;
int status = WriteFile(outfile,filebuffer,numread,&numwritten,NULL);
return status!=0;
}
We know this is a little cryptic(no pun intended) but these functions are
working on different machines as long as they are the same service pack. The
moment we try encrypting a file on a sp2 machine and decrypting the file on
a sp1 machine it fails to decrypt. The same applies vice versa.
Best Regards,
Drew Gilkey and Roy Mayhall
Expand AllCollapse All
Manage Your Profile |Legal |Contact Us |MSDN Flash Newsletter
- Next message: bobby: "Re: Question about cli and win2000"
- Previous message: Gabriel Bogdan: "Re: Shared memory delay"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|