Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clean-ide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
clean-ide
Commits
7f0e5769
Commit
7f0e5769
authored
Jun 16, 2006
by
John van Groningen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
port to 64 bit windows
parent
25b4f1c3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
30 deletions
+80
-30
Win/PatchConsoleEvents/Redirect.c
Win/PatchConsoleEvents/Redirect.c
+33
-1
Win/PatchConsoleEvents/cCrossCallMaarten.c
Win/PatchConsoleEvents/cCrossCallMaarten.c
+42
-24
Win/thread_message.c
Win/thread_message.c
+5
-5
No files found.
Win/PatchConsoleEvents/Redirect.c
View file @
7f0e5769
...
...
@@ -109,6 +109,17 @@ BOOL WINAPI IsWinNT()
return
TRUE
;
}
#ifdef _WIN64
static
void
my_zero_memory
(
void
*
a
,
size_t
n
)
{
unsigned
char
*
p
;
size_t
i
;
p
=
a
;
for
(
i
=
0
;
i
<
n
;
++
i
)
p
[
i
]
=
0
;
}
#endif
// Create standard handles, try to start child from command line.
...
...
@@ -135,7 +146,11 @@ BOOL StartChildProcess(LPCSTR lpszCmdLine, BOOL bShowChildWindow)
hProcess
=
GetCurrentProcess
();
// Set up the security attributes struct.
#ifdef _WIN64
my_zero_memory
(
&
sa
,
sizeof
(
SECURITY_ATTRIBUTES
));
#else
ZeroMemory
(
&
sa
,
sizeof
(
SECURITY_ATTRIBUTES
));
#endif
sa
.
nLength
=
sizeof
(
SECURITY_ATTRIBUTES
);
sa
.
lpSecurityDescriptor
=
NULL
;
sa
.
bInheritHandle
=
TRUE
;
...
...
@@ -324,7 +339,11 @@ HANDLE PrepAndLaunchRedirectedChild(LPCSTR lpszCmdLine,
// Set up the start up info struct.
STARTUPINFO
si
;
#ifdef _WIN64
my_zero_memory
(
&
si
,
sizeof
(
STARTUPINFO
));
#else
ZeroMemory
(
&
si
,
sizeof
(
STARTUPINFO
));
#endif
si
.
cb
=
sizeof
(
STARTUPINFO
);
si
.
dwFlags
=
STARTF_USESTDHANDLES
|
STARTF_USESHOWWINDOW
;
si
.
hStdOutput
=
hStdOut
;
...
...
@@ -489,12 +508,21 @@ static int ProcessThread()
return
0
;
}
int
my_strlen
(
const
char
*
s
)
{
int
l
;
for
(
l
=
0
;
s
[
l
]
!=
'\0'
;
l
++
)
;
return
l
;
}
// Function that write to the child stdin.
int
WriteChildStdIn
(
LPCSTR
lpszInput
)
{
DWORD
nBytesWrote
;
DWORD
Length
=
strlen
(
lpszInput
);
DWORD
Length
=
my_
strlen
(
lpszInput
);
if
(
m_hStdInWrite
!=
NULL
&&
Length
>
0
)
{
if
(
!
WriteFile
(
m_hStdInWrite
,
lpszInput
,
Length
,
&
nBytesWrote
,
NULL
))
...
...
@@ -543,7 +571,11 @@ BOOL AddMainWindowHook (BOOL dummy)
{
if
(
g_pWndProc
==
NULL
)
{
#ifdef _WIN64
g_pWndProc
=
(
WNDPROC
)
SetWindowLongPtr
(
ghMainWindow
,
GWLP_WNDPROC
,(
LONG_PTR
)
SubClassWndProc
);
#else
g_pWndProc
=
(
WNDPROC
)
SetWindowLong
(
ghMainWindow
,
GWL_WNDPROC
,(
LPARAM
)
SubClassWndProc
);
#endif
return
TRUE
;
}
return
FALSE
;
...
...
Win/PatchConsoleEvents/cCrossCallMaarten.c
View file @
7f0e5769
...
...
@@ -42,7 +42,7 @@ void EvalCcRqSETWINDOWICON (CrossCallInfo *pcci)
hIcon
=
LoadIcon
((
HINSTANCE
)
GetModuleHandle
(
NULL
),
MAKEINTRESOURCE
(
idIcon
));
hPrevIcon
=
SendMessage
(
hWnd
,
WM_SETICON
,(
WPARAM
)
ICON_BIG
,(
LPARAM
)
hIcon
);
hPrevIcon
=
(
HICON
)
SendMessage
(
hWnd
,
WM_SETICON
,(
WPARAM
)
ICON_BIG
,(
LPARAM
)
hIcon
);
MakeReturn0Cci
(
pcci
);
}
...
...
@@ -116,6 +116,7 @@ PBITMAPINFO CreateBitmapInfoStruct(HBITMAP hBmp)
return
pbmi
;
}
#if 0
char *CreateBMPFile(PBITMAPINFO pbi, HBITMAP hBMP)
{
BITMAPFILEHEADER hdr; // bitmap file-header
...
...
@@ -195,6 +196,7 @@ char *CreateBMPFile(PBITMAPINFO pbi, HBITMAP hBMP)
GlobalFree((HGLOBAL)lpBits);
return sf;
}
#endif
void
EvalCcRqGETBITMAPRESOURCE
(
CrossCallInfo
*
pcci
)
{
...
...
@@ -220,7 +222,7 @@ void EvalCcRqGETBITMAPRESOURCE (CrossCallInfo *pcci)
pbi
=
CreateBitmapInfoStruct
(
hBitmap
);
// data = CreateBMPFile(pbi, hBitmap);
MakeReturn4Cci
(
pcci
,
hBitmap
,
0
/*data*/
,
pbi
->
bmiHeader
.
biWidth
,
pbi
->
bmiHeader
.
biHeight
);
MakeReturn4Cci
(
pcci
,
(
size_t
)
hBitmap
,
0
/*data*/
,
pbi
->
bmiHeader
.
biWidth
,
pbi
->
bmiHeader
.
biHeight
);
GlobalFree
(
pbi
);
return
;
/*
...
...
@@ -237,7 +239,7 @@ void EvalCcRqGETBITMAPRESOURCE (CrossCallInfo *pcci)
*/
}
void
WinGetBitmapResource
(
int
idBitmap
,
int
intoolbox
,
in
t
*
outbitmap
,
int
*
width
,
int
*
height
,
int
*
outtoolbox
)
void
WinGetBitmapResource
(
int
idBitmap
,
int
intoolbox
,
size_
t
*
outbitmap
,
int
*
width
,
int
*
height
,
int
*
outtoolbox
)
{
HANDLE
hBitmap
;
char
*
data
;
...
...
@@ -260,12 +262,16 @@ void WinGetBitmapResource(int idBitmap, int intoolbox, int *outbitmap, int *widt
*
width
=
pbi
->
bmiHeader
.
biWidth
;
*
height
=
pbi
->
bmiHeader
.
biHeight
;
GlobalFree
(
pbi
);
*
outbitmap
=
hBitmap
;
*
outbitmap
=
(
size_t
)
hBitmap
;
*
outtoolbox
=
intoolbox
;
return
;
}
#ifdef _WIN64
static
int
APIENTRY
DirectorySelectorHook
(
HWND
hdlg
,
UINT
uiMsg
,
LPARAM
wParam
,
LPARAM
lParam
)
#else
static
UINT
APIENTRY
DirectorySelectorHook
(
HWND
hdlg
,
UINT
uiMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
#endif
{
if
(
uiMsg
==
BFFM_INITIALIZED
)
{
...
...
@@ -275,7 +281,11 @@ static UINT APIENTRY DirectorySelectorHook (HWND hdlg, UINT uiMsg, WPARAM wParam
return
0
;
}
#ifdef _WIN64
static
UINT_PTR
APIENTRY
FileSelectorHook
(
HWND
hdlg
,
UINT
uiMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
#else
static
UINT
APIENTRY
FileSelectorHook
(
HWND
hdlg
,
UINT
uiMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
#endif
{
if
(
uiMsg
==
WM_INITDIALOG
)
{
...
...
@@ -287,7 +297,7 @@ static UINT APIENTRY FileSelectorHook (HWND hdlg, UINT uiMsg, WPARAM wParam, LPA
y
=
(
GetSystemMetrics
(
SM_CYSCREEN
)
>>
1
)
-
((
rect
.
bottom
-
rect
.
top
)
>>
1
);
SetWindowPos
(
hdlg
,
NULL
,
x
,
y
,
0
,
0
,
SWP_NOACTIVATE
|
SWP_NOSIZE
|
SWP_NOZORDER
);
if
((
lParam
!=
NULL
)
&&
(((
LPOPENFILENAME
)
lParam
)
->
lCustData
!=
NULL
)
)
if
(
lParam
!=
0
&&
((
LPOPENFILENAME
)
lParam
)
->
lCustData
!=
0
)
SendMessage
(
GetParent
(
hdlg
),
CDM_SETCONTROLTEXT
,
IDOK
,((
LPOPENFILENAME
)
lParam
)
->
lCustData
);
}
...
...
@@ -364,7 +374,11 @@ void EvalCcRqALTFILEOPENDIALOG (CrossCallInfo *pcci) /* no params; bool, textp
}
else
{
#ifdef _WIN64
ofn
.
lStructSize
=
sizeof
(
OPENFILENAME_NT4
);
#else
ofn
.
lStructSize
=
OPENFILENAME_SIZE_VERSION_400
;
#endif
}
ofn
.
hwndOwner
=
GetActiveWindow
();
...
...
@@ -389,7 +403,7 @@ void EvalCcRqALTFILEOPENDIALOG (CrossCallInfo *pcci) /* no params; bool, textp
// | OFN_ENABLEHOOK; // PA: OFN_ENABLEHOOK added from Ronny
ofn
.
lpstrDefExt
=
NULL
;
ofn
.
lCustData
=
NULL
;
ofn
.
lCustData
=
(
LPARAM
)
NULL
;
ofn
.
lpfnHook
=
&
FileSelectorHook
;
// PA: &FileSelectorHook instead of NULL from Ronny
ofn
.
lpTemplateName
=
NULL
;
#if (_WIN32_WINNT >= 0x0500)
...
...
@@ -402,12 +416,12 @@ void EvalCcRqALTFILEOPENDIALOG (CrossCallInfo *pcci) /* no params; bool, textp
if
(
success
)
{
MakeReturn2Cci
(
pcci
,
success
,
(
in
t
)
ofn
.
lpstrFile
);
MakeReturn2Cci
(
pcci
,
success
,
(
size_
t
)
ofn
.
lpstrFile
);
/* and have the calling clean function deallocate the filename buffer */
}
else
{
MakeReturn2Cci
(
pcci
,
success
,
(
in
t
)
NULL
);
MakeReturn2Cci
(
pcci
,
success
,
(
size_
t
)
NULL
);
rfree
(
ofn
.
lpstrFile
);
}
}
...
...
@@ -437,7 +451,11 @@ void EvalCcRqALTFILESAVEDIALOG (CrossCallInfo *pcci) /* promptptr, nameptr; boo
}
else
{
#ifdef _WIN64
ofn
.
lStructSize
=
sizeof
(
OPENFILENAME_NT4
);
#else
ofn
.
lStructSize
=
OPENFILENAME_SIZE_VERSION_400
;
#endif
}
ofn
.
hwndOwner
=
GetActiveWindow
();
...
...
@@ -470,7 +488,7 @@ void EvalCcRqALTFILESAVEDIALOG (CrossCallInfo *pcci) /* promptptr, nameptr; boo
okptr
=
NULL
;
/* the calling clean function will
deallocate the memory allocated
for this empty string */
ofn
.
lCustData
=
okptr
;
ofn
.
lCustData
=
(
LPARAM
)
okptr
;
ofn
.
lpfnHook
=
&
FileSelectorHook
;
// PA: &FileSelectorHook instead of NULL from Ronny
ofn
.
lpTemplateName
=
NULL
;
#if (_WIN32_WINNT >= 0x0500)
...
...
@@ -483,12 +501,12 @@ void EvalCcRqALTFILESAVEDIALOG (CrossCallInfo *pcci) /* promptptr, nameptr; boo
if
(
success
)
{
MakeReturn2Cci
(
pcci
,
success
,
(
in
t
)
ofn
.
lpstrFile
);
MakeReturn2Cci
(
pcci
,
success
,
(
size_
t
)
ofn
.
lpstrFile
);
/* and have the calling clean function deallocate the filename buffer */
}
else
{
MakeReturn2Cci
(
pcci
,
success
,
(
in
t
)
NULL
);
MakeReturn2Cci
(
pcci
,
success
,
(
size_
t
)
NULL
);
rfree
(
ofn
.
lpstrFile
);
}
}
...
...
@@ -499,10 +517,10 @@ void EvalCcRqALTDIRECTORYDIALOG (CrossCallInfo *pcci) /* no params; bool, text
LPITEMIDLIST
pidlReturn
;
BROWSEINFO
bi
;
char
*
s
;
char
*
initialptr
;
LPARAM
initialptr
;
char
title
[
17
]
=
"Select Directory
\0
"
;
initialptr
=
(
char
*
)
pcci
->
p1
;
initialptr
=
(
LPARAM
)
pcci
->
p1
;
bi
.
hwndOwner
=
GetActiveWindow
();
bi
.
pidlRoot
=
NULL
;
...
...
@@ -522,13 +540,13 @@ void EvalCcRqALTDIRECTORYDIALOG (CrossCallInfo *pcci) /* no params; bool, text
CoTaskMemFree
(
pidlReturn
);
CoUninitialize
();
// Uninitialise the COM library
MakeReturn2Cci
(
pcci
,
(
int
)
TRUE
,
(
in
t
)
s
);
MakeReturn2Cci
(
pcci
,
TRUE
,
(
size_
t
)
s
);
/* and have the calling Clean function deallocate the directory name buffer. */
}
else
{
CoUninitialize
();
// Uninitialise the COM library
MakeReturn2Cci
(
pcci
,
(
int
)
FALSE
,
(
in
t
)
NULL
);
MakeReturn2Cci
(
pcci
,
FALSE
,
(
size_
t
)
NULL
);
}
}
...
...
@@ -536,17 +554,17 @@ void EvalCcRqSHELLDEFAULT (CrossCallInfo *pcci) /* parentPtr, controlPtr, textPt
{
HWND
hwndParent
;
/* The handle to the window. */
TOOLINFO
ti
;
/* The tool information that is sent to the tooltip control. */
char
*
file
;
int
verb
,
retn
;
LPCTSTR
file
,
verb
;
HINSTANCE
retn
;
rectTTId
++
;
hwndParent
=
NULL
;
//GetActiveWindow();//ghMainWindow;
verb
=
(
INT
)
pcci
->
p1
;
file
=
(
char
*
)
pcci
->
p2
;
verb
=
(
LPCTSTR
)
pcci
->
p1
;
file
=
(
LPCTSTR
)
pcci
->
p2
;
retn
=
(
int
)
ShellExecute
(
hwndParent
,
verb
,
file
,
0
,
0
,
1
);
MakeReturn1Cci
(
pcci
,
retn
);
retn
=
ShellExecute
(
hwndParent
,
verb
,
file
,
0
,
0
,
1
);
MakeReturn1Cci
(
pcci
,
(
size_t
)
retn
);
}
/* Install the cross call procedures in the gCrossCallProcedureTable of cCrossCall_121.
...
...
Win/thread_message.c
View file @
7f0e5769
...
...
@@ -47,7 +47,7 @@ void install_compiler_result_handler (void)
}
int
start_compiler_process
(
CleanString
compiler_path
,
CleanString
compiler_directory
,
CleanString
command
,
int
*
compiler_thread_id_p
,
int
*
compiler_thread_handle_p
,
in
t
*
compiler_process_handle_p
)
int
*
compiler_thread_id_p
,
size_t
*
compiler_thread_handle_p
,
size_
t
*
compiler_process_handle_p
)
{
PSTR
application_name
,
command_line
,
env
,
dir
;
STARTUPINFO
si
;
...
...
@@ -107,7 +107,7 @@ int get_integers_from_message (int wm_number,int *i1_p,int *i2_p)
#define PM_QS_POSTMESSAGE ((QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16)
int
get_integers_from_thread_message
(
int
wm_number
,
in
t
thread_handle
,
int
*
i1_p
,
int
*
i2_p
)
int
get_integers_from_thread_message
(
int
wm_number
,
size_
t
thread_handle
,
int
*
i1_p
,
int
*
i2_p
)
{
MSG
message
;
int
r
;
...
...
@@ -139,7 +139,7 @@ int get_integers_from_thread_message (int wm_number,int thread_handle,int *i1_p,
return
r
;
}
int
get_string_from_file_map_and_delete_map
(
in
t
file_map
,
CleanString
s
)
int
get_string_from_file_map_and_delete_map
(
size_
t
file_map
,
CleanString
s
)
{
int
l
,
i
;
char
*
chars
,
*
p
;
...
...
@@ -161,7 +161,7 @@ int get_string_from_file_map_and_delete_map (int file_map,CleanString s)
return
1
;
}
int
send_string_to_thread
(
int
thread_id
,
in
t
process_handle
,
int
wm_number
,
CleanString
s
)
int
send_string_to_thread
(
int
thread_id
,
size_
t
process_handle
,
int
wm_number
,
CleanString
s
)
{
HANDLE
file_map
,
file_map2
;
char
*
chars
,
*
p1
;
...
...
@@ -176,7 +176,7 @@ int send_string_to_thread (int thread_id,int process_handle,int wm_number,CleanS
if
(
l
==
0
||
chars
[
l
-
1
]
!=
'\0'
)
return
0
;
file_map
=
CreateFileMapping
((
HANDLE
)
0xFFFFFFFF
,
NULL
,
PAGE_READWRITE
,
0
,
l
,
NULL
);
file_map
=
CreateFileMapping
((
HANDLE
)
(
-
1
)
,
NULL
,
PAGE_READWRITE
,
0
,
l
,
NULL
);
if
(
file_map
==
NULL
)
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment