mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[mingw] added MinGW support
* only MinGW-w64 for now * Makefile is called GNUmakefile so as not to conflict with WDK
This commit is contained in:
parent
67a07909b1
commit
d6f32a189a
5 changed files with 40 additions and 6 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -1,6 +1,7 @@
|
||||||
*.sh eol=lf
|
*.sh eol=lf
|
||||||
*.ac eol=lf
|
*.ac eol=lf
|
||||||
*.am eol=lf
|
*.am eol=lf
|
||||||
|
GNUmakefile eol=lf
|
||||||
*.sln eol=crlf
|
*.sln eol=crlf
|
||||||
*.vcproj eol=crlf
|
*.vcproj eol=crlf
|
||||||
*.vcxproj* eol=crlf
|
*.vcxproj* eol=crlf
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -24,7 +24,6 @@
|
||||||
.libs
|
.libs
|
||||||
Debug
|
Debug
|
||||||
INSTALL
|
INSTALL
|
||||||
Makefile
|
|
||||||
Makefile.in
|
Makefile.in
|
||||||
Release
|
Release
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
|
|
23
GNUmakefile
Normal file
23
GNUmakefile
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
TARGETNAME=rufus
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
RC = windres
|
||||||
|
STRIP = strip
|
||||||
|
CFLAGS = -std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow -O2 -Wl,--subsystem,windows
|
||||||
|
LIBS = -lsetupapi -lole32
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: $(TARGETNAME)
|
||||||
|
|
||||||
|
$(TARGETNAME): $(TARGETNAME).c $(TARGETNAME)_rc.o
|
||||||
|
@echo "[CCLD] $@"
|
||||||
|
@$(CC) -o $@ $(CFLAGS) $^ $(TARGETNAME)_rc.o $(LIBS)
|
||||||
|
@$(STRIP) $(TARGETNAME).exe
|
||||||
|
|
||||||
|
$(TARGETNAME)_rc.o: $(TARGETNAME).rc
|
||||||
|
@echo "[RC] $@"
|
||||||
|
@$(RC) -i $< -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.exe *.o
|
11
rufus.c
11
rufus.c
|
@ -189,6 +189,7 @@ static BOOL GetDriveInfo(DWORD num, LONGLONG* DriveSize, char* FSType, DWORD FST
|
||||||
HANDLE hDrive;
|
HANDLE hDrive;
|
||||||
DWORD size;
|
DWORD size;
|
||||||
BYTE geometry[128];
|
BYTE geometry[128];
|
||||||
|
void* disk_geometry = (void*)geometry;
|
||||||
char DrivePath[] = "#:\\";
|
char DrivePath[] = "#:\\";
|
||||||
|
|
||||||
*DriveSize = 0;
|
*DriveSize = 0;
|
||||||
|
@ -203,7 +204,7 @@ static BOOL GetDriveInfo(DWORD num, LONGLONG* DriveSize, char* FSType, DWORD FST
|
||||||
safe_closehandle(hDrive);
|
safe_closehandle(hDrive);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
*DriveSize = ((PDISK_GEOMETRY_EX)geometry)->DiskSize.QuadPart;
|
*DriveSize = ((PDISK_GEOMETRY_EX)(disk_geometry))->DiskSize.QuadPart;
|
||||||
|
|
||||||
safe_closehandle(hDrive);
|
safe_closehandle(hDrive);
|
||||||
|
|
||||||
|
@ -400,7 +401,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
||||||
/*
|
/*
|
||||||
* Center a dialog with regards to the main application Window or the desktop
|
* Center a dialog with regards to the main application Window or the desktop
|
||||||
*/
|
*/
|
||||||
void CenterDialog(HWND hDialog)
|
void CenterDialog(HWND hDlg)
|
||||||
{
|
{
|
||||||
POINT Point;
|
POINT Point;
|
||||||
HWND hParent;
|
HWND hParent;
|
||||||
|
@ -410,10 +411,10 @@ void CenterDialog(HWND hDialog)
|
||||||
int nHeight;
|
int nHeight;
|
||||||
|
|
||||||
// Get the size of the dialog box.
|
// Get the size of the dialog box.
|
||||||
GetWindowRect(hDialog, &DialogRect);
|
GetWindowRect(hDlg, &DialogRect);
|
||||||
|
|
||||||
// Get the parent
|
// Get the parent
|
||||||
hParent = GetParent(hDialog);
|
hParent = GetParent(hDlg);
|
||||||
if (hParent == NULL) {
|
if (hParent == NULL) {
|
||||||
hParent = GetDesktopWindow();
|
hParent = GetDesktopWindow();
|
||||||
}
|
}
|
||||||
|
@ -433,7 +434,7 @@ void CenterDialog(HWND hDialog)
|
||||||
Point.y -= nHeight / 2 + 35;
|
Point.y -= nHeight / 2 + 35;
|
||||||
|
|
||||||
// Move the window.
|
// Move the window.
|
||||||
MoveWindow(hDialog, Point.x, Point.y, nWidth, nHeight, FALSE);
|
MoveWindow(hDlg, Point.x, Point.y, nWidth, nHeight, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
10
rufus.rc
10
rufus.rc
|
@ -68,6 +68,11 @@ END
|
||||||
3 TEXTINCLUDE
|
3 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"\r\n"
|
"\r\n"
|
||||||
|
"// Must reference a manifest for visual styles and elevation\r\n"
|
||||||
|
"// Oh, and it must happen at the end, or MinGW will ignore it!\r\n"
|
||||||
|
"#if defined(__GNUC__)\r\n"
|
||||||
|
"CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST ""common_controls_and_elevation.manifest""\r\n"
|
||||||
|
"#endif\r\n"
|
||||||
"\0"
|
"\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -148,6 +153,11 @@ IDI_ICON ICON "rufus.ico"
|
||||||
// Generated from the TEXTINCLUDE 3 resource.
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// Must reference a manifest for visual styles and elevation
|
||||||
|
// Oh, and it must happen at the end, or MinGW will ignore it!
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "common_controls_and_elevation.manifest"
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
#endif // not APSTUDIO_INVOKED
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
Loading…
Reference in a new issue