-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrawdata.c
More file actions
executable file
·82 lines (63 loc) · 1.78 KB
/
rawdata.c
File metadata and controls
executable file
·82 lines (63 loc) · 1.78 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <windows.h>
#include "resource.h"
#include "structs.h"
#include "common.h"
#include "globals.h"
#include "ui.h"
#include "utility.h"
BOOL CALLBACK RawDataDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
struct packet *pkt;
unsigned char *ret;
RECT rect = {50, 50, 480, 300};
switch (uMsg)
{
case WM_INITDIALOG:
GetPrivateProfileStruct("Packet Capture", "RawData Rect", &rect, sizeof(RECT), "NetworkSpy.ini");
/* Sanity Check */
if ((rect.left < 0) || (rect.top < 0) ||
(rect.left > GetSystemMetrics(SM_CXSCREEN)-50) ||
(rect.top > GetSystemMetrics(SM_CYSCREEN)-50))
{
rect.left = 50;
rect.top = 50;
rect.right = 480;
rect.bottom = 300;
}
MoveWindow(hDlg, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE);
pkt = (struct packet *) GetSelectedItemLParam(hWndAlertList);
if (pkt == NULL)
return TRUE;
ret = malloc(32000);
PrintRawData(pkt->data, pkt->size, ret);
SetDlgItemText(hDlg, IDC_EDIT_DATA, ret);
free (ret);
return TRUE;
case WM_ACTIVATE:
if( LOWORD( wParam ) == WA_INACTIVE )
hModelessDlg = NULL;
else
hModelessDlg = hDlg;
return TRUE;
case WM_SIZE:
MoveWindow(GetDlgItem(hDlg, IDC_EDIT_DATA), 10, 10, LOWORD(lParam) - 20, HIWORD(lParam) - 20, TRUE);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case ID_CLOSE:
DestroyWindow(hDlg);
return TRUE;
}
break;
case WM_CLOSE:
DestroyWindow(hDlg);
return TRUE;
case WM_DESTROY:
GetWindowRect(hDlg, &rect);
WritePrivateProfileStruct("Packet Capture", "RawData Rect", &rect, sizeof(RECT), "NetworkSpy.ini");
hModelessDlg = NULL;
return TRUE;
}
return FALSE;
}