7 #include "systeminfo.h"
10 * These are the functions for handling the context menu.
13 static STDMETHODIMP
query_context_menu(void *p
, HMENU menu
,
14 UINT index
, UINT first_command
,
15 UINT last_command
, UINT flags
)
17 struct git_menu
*this_menu
= p
;
18 struct git_data
*this_
= this_menu
->git_data
;
20 if (flags
& CMF_DEFAULTONLY
)
21 return MAKE_HRESULT(SEVERITY_SUCCESS
, FACILITY_NULL
, 0);
23 InsertMenu(menu
, index
, MF_STRING
| MF_BYPOSITION
,
24 first_command
, _T("Git Gui"));
26 return MAKE_HRESULT(SEVERITY_SUCCESS
, FACILITY_NULL
, 1);
29 static STDMETHODIMP
invoke_command(void *p
,
30 LPCMINVOKECOMMANDINFO info
)
32 struct git_menu
*this_menu
= p
;
33 struct git_data
*this_
= this_menu
->git_data
;
34 int command
= LOWORD(info
->lpVerb
);
36 if (HIWORD(info
->lpVerb
) != 0)
41 STARTUPINFO si
= { sizeof(si
) };
42 PROCESS_INFORMATION pi
;
44 TCHAR
* msysPath
= msys_path();
49 wsprintf(command
, TEXT("%s\\bin\\sh.exe --login /bin/git-gui"),
58 0, NULL
, NULL
, &si
, &pi
))
60 CloseHandle(pi
.hProcess
);
61 CloseHandle(pi
.hThread
);
65 debug_git("[ERROR] %s/%s:%d Could not create git gui process (%d)",
66 __FILE__
, __FUNCTION__
, __LINE__
,
72 debug_git("[ERROR] %s/%s:%d Could not find msysPath",
73 __FILE__
, __FUNCTION__
, __LINE__
);
82 static STDMETHODIMP
get_command_string(void *p
, UINT id
,
83 UINT flags
, UINT
*reserved
,
84 LPSTR name
, UINT size
)
86 struct git_menu
*this_menu
= p
;
87 struct git_data
*this_
= this_menu
->git_data
;
93 if (flags
& GCS_HELPTEXT
) {
94 LPCTSTR text
= _T("This is the simple shell extension's help");
96 if (flags
& GCS_UNICODE
)
97 lstrcpynW((LPWSTR
)name
, mbrtowc(text
), size
);
99 lstrcpynA(name
, text
, size
);
108 DEFINE_STANDARD_METHODS(git_menu
)
110 struct git_menu_virtual_table git_menu_virtual_table
= {
111 query_interface_git_menu
,