[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:
Pete Batard 2011-11-20 03:29:08 +00:00
parent 67a07909b1
commit d6f32a189a
5 changed files with 40 additions and 6 deletions

1
.gitattributes vendored
View File

@ -1,6 +1,7 @@
*.sh eol=lf
*.ac eol=lf
*.am eol=lf
GNUmakefile eol=lf
*.sln eol=crlf
*.vcproj eol=crlf
*.vcxproj* eol=crlf

1
.gitignore vendored
View File

@ -24,7 +24,6 @@
.libs
Debug
INSTALL
Makefile
Makefile.in
Release
aclocal.m4

23
GNUmakefile Normal file
View 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
View File

@ -189,6 +189,7 @@ static BOOL GetDriveInfo(DWORD num, LONGLONG* DriveSize, char* FSType, DWORD FST
HANDLE hDrive;
DWORD size;
BYTE geometry[128];
void* disk_geometry = (void*)geometry;
char DrivePath[] = "#:\\";
*DriveSize = 0;
@ -203,7 +204,7 @@ static BOOL GetDriveInfo(DWORD num, LONGLONG* DriveSize, char* FSType, DWORD FST
safe_closehandle(hDrive);
return FALSE;
}
*DriveSize = ((PDISK_GEOMETRY_EX)geometry)->DiskSize.QuadPart;
*DriveSize = ((PDISK_GEOMETRY_EX)(disk_geometry))->DiskSize.QuadPart;
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
*/
void CenterDialog(HWND hDialog)
void CenterDialog(HWND hDlg)
{
POINT Point;
HWND hParent;
@ -410,10 +411,10 @@ void CenterDialog(HWND hDialog)
int nHeight;
// Get the size of the dialog box.
GetWindowRect(hDialog, &DialogRect);
GetWindowRect(hDlg, &DialogRect);
// Get the parent
hParent = GetParent(hDialog);
hParent = GetParent(hDlg);
if (hParent == NULL) {
hParent = GetDesktopWindow();
}
@ -433,7 +434,7 @@ void CenterDialog(HWND hDialog)
Point.y -= nHeight / 2 + 35;
// Move the window.
MoveWindow(hDialog, Point.x, Point.y, nWidth, nHeight, FALSE);
MoveWindow(hDlg, Point.x, Point.y, nWidth, nHeight, FALSE);
}
/*

View File

@ -68,6 +68,11 @@ END
3 TEXTINCLUDE
BEGIN
"\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"
END
@ -148,6 +153,11 @@ IDI_ICON ICON "rufus.ico"
// 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