Skip to content

Commit

Permalink
ECU SeedKey Class init
Browse files Browse the repository at this point in the history
  • Loading branch information
Xplatforms committed Oct 5, 2020
1 parent b28e666 commit 35f83d7
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ecuseedkeydll.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "ecuseedkeydll.h"
#include <QDir>
#include <QFileInfo>
#include <QTimer>
#include <QDebug>
#include <signal.h>

auto tmp_ret_def_seedkey_len = [](int){return 4;};

QString GetLastErrorAsString()
{
//Get the error message, if any.
auto errorMessageID = ::GetLastError();
if(errorMessageID == 0)return QStringLiteral(""); //No error message has been recorded

LPWSTR messageBuffer = Q_NULLPTR;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), messageBuffer, 0, NULL);

auto message = QString::fromWCharArray(messageBuffer, size);
LocalFree(messageBuffer);

return message;
}
26 changes: 26 additions & 0 deletions ecuseedkeydll.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef ECUSEEDKEYDLL_H
#define ECUSEEDKEYDLL_H

#include <QObject>
#include <QString>
#include <QHash>
#include <Windows.h>

typedef int (__cdecl *_f_GetConfiguredAccessTypes)(int *);
typedef int (__cdecl *_f_GetSeedLength)(int);
typedef int (__cdecl *_f_GetKeyLength)(int);
typedef const char * (__cdecl *_f_GetECUName)();
typedef const char * (__cdecl *_f_GetComment)();

typedef int (__cdecl * _f_GenerateKeyExOpt )( const unsigned char* ipSeedArray,
unsigned int iSeedArraySize,
const unsigned int iSecurityLevel,
const char * ipVariant,
const char* ipOptions,
unsigned char* iopKeyArray,
unsigned int iMaxKeyArraySize,
unsigned int& oActualKeyArraySize );



#endif // ECUSEEDKEYDLL_H

0 comments on commit 35f83d7

Please sign in to comment.