#ifndef NIST_DEMO_H_
#define NIST_DEMO_H_

//Defined controls IDs (no .rc file)
#define IMG_BITMAP			         1
#define CreateAndInsertButton    2
#define ReadAndModifyButton      3
#define ReadAndExportButton      4
#define ReadSingleFieldButton    5
#define DeleteSingleFieldButton  6
#define RegisterButton           7




const wchar_t* w_g_szNistClass = L"NISTClass";
const char* g_szNistClass = "NISTClass";
HINSTANCE g_hInstance = 0;
HWND g_hwnd = 0;
HWND g_bitmapWnd = 0;
HWND g_hwndCreateAndInsertButton = 0;
HWND g_hwndReadAndModifyButton = 0;
HWND g_hwndReadAndExportButton = 0;
HWND g_hwndReadSingleFieldButton = 0;
HWND g_hwndDeleteSingleFieldButton = 0;
HWND g_hwndRegisterButton = 0;
HBITMAP hBitmap = 0;
BITMAP g_pic;



wchar_t program_file_path[MAX_PATH];
wchar_t filedirectory[MAX_PATH];
wchar_t filename[MAX_PATH];
char* p_image_compression_code;
char image_compression_code[128];
//char output_message[16384];
wchar_t output_message[16384];
int size;
int idc;
int idc_current;
char* nist_txt_field;
wchar_t* w_nist_txt_field;
int nist_int_field;
//char int_converted_to_string[64];
wchar_t int_converted_to_string[64];
unsigned char* nist_binary_field;
unsigned char* byte_array;
int size_of_byte_array;
int type_2_number_of_records;
int type_3_number_of_records;
int type_4_number_of_records;
int type_5_number_of_records;
int type_6_number_of_records;
int type_7_number_of_records;
int type_8_number_of_records;
int type_9_number_of_records;
int type_10_number_of_records;
int type_13_number_of_records;
int type_14_number_of_records;
int type_15_number_of_records;
int type_16_number_of_records;
int type_17_number_of_records;
int type_99_number_of_records;



int ret = 0;
int n = 0;
FILE *infp, *outfp;
int handle = 0;

HCURSOR hcurSave;


HINSTANCE g_nistLibrary = 0;

//NIST library declaration of functions
typedef int (WINAPI *RegisterNIST)();
typedef int (WINAPI *CreateNewNISTFile)();
typedef int (WINAPI *WriteNISTToFile)(const char *filename);
typedef unsigned char* (WINAPI *ReadNISTByteArray)();
typedef int (WINAPI *ReadSizeOfNISTByteArray)();
typedef int (WINAPI *ReadNISTFromFile)(const char *filename);
typedef int (WINAPI *ReadNISTFromMemory)(unsigned char* input_byte_array, int size_of_input_byte_array);
typedef int (WINAPI *CheckIfRecordTypeExists)(int record_type_number);
typedef int (WINAPI *ReadNumberOfRecords)(int record_type_number);
typedef int (WINAPI *ReadIDCofRecord)(int record_type_number, int record_number);
typedef char* (WINAPI *ReadRecordTxtField)(int record_type_number, int idc, int record_field_number, const char *record_field_name);
typedef int (WINAPI *ReadSizeOfRecordTxtField)(int record_type_number, int idc, int record_field_number, const char *record_field_name);
typedef char* (WINAPI *ReadRecordTxtFieldName)(int record_type_number, int idc, int record_field_number);
typedef int (WINAPI *ReadSizeOfRecordTxtFieldName)(int record_type_number, int idc, int record_field_number, const char *record_field_name);
typedef char* (WINAPI *ReadRecordTxtFieldDescription)(int record_type_number, int idc, int record_field_number, const char *record_field_name);
typedef int (WINAPI *ReadSizeOfRecordTxtFieldDescription)(int record_type_number, int idc, int record_field_number, const char *record_field_name);
typedef char* (WINAPI *ReadRecordExportedTxtFields)(int record_type_number, int idc);
typedef int (WINAPI *ReadSizeOfRecordExportedTxtFields)(int record_type_number, int idc);
typedef unsigned char* (WINAPI *ReadRecordBinaryField)(int record_type_number, int idc);
typedef int (WINAPI *ReadSizeOfRecordBinaryField)(int record_type_number, int idc);
typedef HBITMAP (WINAPI *CreateHBITMAPfromRecordBinaryField)(int record_type_number, int idc);
typedef int (WINAPI *InsertRecordBinaryFieldFromFile)(int record_type_number, int idc, const char *filename);
typedef int (WINAPI *InsertRecordBinaryFieldFromMemory)(int record_type_number, int idc, unsigned char* input_byte_array, int size_of_input_byte_array, const char* CGA, int CGA_int, int HLL, int VLL);
typedef int (WINAPI *InsertRecordTxtField)(int record_type_number, int idc, int record_field_number, const char *record_field_name, const char * input_data);
typedef int (WINAPI *DeleteRecord)(int record_type_number, int idc);


RegisterNIST pRegisterNIST = 0;
CreateNewNISTFile pCreateNewNISTFile = 0;
WriteNISTToFile pWriteNISTToFile = 0;
ReadNISTByteArray pReadNISTByteArray = 0;
ReadSizeOfNISTByteArray pReadSizeOfNISTByteArray = 0;
ReadNISTFromFile pReadNISTFromFile = 0;
ReadNISTFromMemory pReadNISTFromMemory = 0;
CheckIfRecordTypeExists pCheckIfRecordTypeExists = 0;
ReadNumberOfRecords pReadNumberOfRecords = 0;
ReadIDCofRecord pReadIDCofRecord = 0;
ReadRecordTxtField pReadRecordTxtField = 0;
ReadSizeOfRecordTxtField pReadSizeOfRecordTxtField = 0;
ReadRecordTxtFieldName pReadRecordTxtFieldName = 0;
ReadSizeOfRecordTxtFieldName pReadSizeOfRecordTxtFieldName = 0;
ReadRecordTxtFieldDescription pReadRecordTxtFieldDescription = 0;
ReadSizeOfRecordTxtFieldDescription pReadSizeOfRecordTxtFieldDescription = 0;
ReadRecordExportedTxtFields pReadRecordExportedTxtFields = 0;
ReadSizeOfRecordExportedTxtFields pReadSizeOfRecordExportedTxtFields = 0;
ReadRecordBinaryField pReadRecordBinaryField = 0;
ReadSizeOfRecordBinaryField pReadSizeOfRecordBinaryField = 0;
CreateHBITMAPfromRecordBinaryField pCreateHBITMAPfromRecordBinaryField = 0;
InsertRecordBinaryFieldFromFile pInsertRecordBinaryFieldFromFile = 0;
InsertRecordBinaryFieldFromMemory pInsertRecordBinaryFieldFromMemory = 0;
InsertRecordTxtField pInsertRecordTxtField = 0;
DeleteRecord pDeleteRecord = 0;


bool LoadNISTLibrary();
void CreateAndInsertButtonClick();
void ReadAndModifyButtonClick();
void ReadAndExportButtonClick();
void ReadSingleFieldButtonClick();
void DeleteSingleFieldButtonClick();
void RegisterButtonClick();


LRESULT CALLBACK WndProc( HWND hWnd , UINT message , WPARAM wParam , LPARAM lParam);

#endif /*NIST_DEMO_H_*/
