-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathUtility.h
More file actions
42 lines (33 loc) · 1.27 KB
/
Copy pathUtility.h
File metadata and controls
42 lines (33 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// ****************************************************************************
// File: Utility.h
// Desc: Utility functions
//
// ****************************************************************************
#pragma once
#include <string>
// Size of string with out terminator
#define SIZESTR(x) (sizeof(x) - 1)
// Data and function alignment
#define ALIGN(_x_) __declspec(align(_x_))
// Tick IDA's Qt message pump so it will show msg() output
#define refreshUI() WaitBox::processIdaEvents()
#define CATCH() catch (...) { msg("** Exception in %s()! ***\n", __FUNCTION__); }
// Stack alignment trick, based on Douglas Walker's post
// http://www.gamasutra.com/view/feature/3975/data_alignment_part_2_objects_on_.php
#define STACKALIGN(name, type) \
BYTE space_##name[sizeof(type) + (16-1)]; \
type &name = *reinterpret_cast<type *>((UINT_PTR) (space_##name + (16-1)) & ~(16-1))
// ea_t zero padded hex number format
#ifndef __EA64__
#define EAFORMAT "%08X"
#else
#define EAFORMAT "%016I64X"
#endif
typedef double TIMESTAMP;
#define SECOND 1
#define MINUTE (60 * SECOND)
#define HOUR (60 * MINUTE)
#define DAY (HOUR * 24)
TIMESTAMP getTimeStamp();
LPCSTR timeString(TIMESTAMP Time);
LPSTR prettyNumberString(UINT64 n, __bcount(32) LPSTR buffer);