M
M
Maxim Maxim2019-02-19 09:42:26
C++ / C#
Maxim Maxim, 2019-02-19 09:42:26

Who can help with the visual code?

Good afternoon, comrades,
I'm new to programming and I ran into a problem, I can't compile the code, can you tell me why such errors occur and how to fix it in order to compile the .dll
Actually, here's the code:

#include <stdafx.h>
#include <CRC.h>


DWORD __fastcall ComputeCRC(BYTE* data, int size)
{
  int crc, i;

  crc = 0;

  BYTE* ptr = data;
  int count = size;

  while (--count >= 0)
  {
    crc = crc ^ (int)*ptr++ << 8;
    for (i = 0; i < 8; ++i)
      if (crc & 0x8000)
        crc = crc << 1 ^ 0x10213465;
      else
        crc = crc << 1;
  }
  return (crc & 0xFFFFFFFF);
}

DWORD __fastcall ComputeFileCRC(char* file)
{
  FILE* hFile = fopen(file, "rb");

  if (!hFile)
    return 0;

  fseek(hFile, 0, SEEK_END);
  long size = ftell(hFile);
  fseek(hFile, 0, SEEK_SET);

  BYTE* buff = new BYTE[size];
  fread(buff, 1, size, hFile);

  DWORD crc = ComputeCRC(buff, size);

  fclose(hFile);
  delete [] buff;

  return crc;
}

Here are the shoals:
5c6ba5414f819471832126.png
Thank you in advance for all your help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2019-02-19
@res2001

Perhaps in CRC.h (or somewhere else) functions are declared to return int, but in the implementation they return DWORD.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question