Skip to content

Commit b86a99b

Browse files
authored
Add um::objidl::IPersistFile and um::shobjidl_core::IShellLink (#788)
* Add `um::objidl::IPersistFile` * Add `um::shobjidl_core::IShellLink`
1 parent 93ae34b commit b86a99b

File tree

3 files changed

+159
-3
lines changed

3 files changed

+159
-3
lines changed

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ const DATA: &'static [(&'static str, &'static [&'static str], &'static [&'static
313313
("shellscalingapi", &["minwindef", "windef", "winnt"], &["shcore"]),
314314
("shlobj", &["guiddef", "minwinbase", "minwindef", "shtypes", "windef", "winnt"], &["shell32"]),
315315
("shobjidl", &["guiddef", "minwindef", "propsys", "shobjidl_core", "shtypes", "unknwnbase", "windef", "winnt"], &[]),
316-
("shobjidl_core", &["commctrl", "guiddef", "minwindef", "objidl", "propkeydef", "propsys", "unknwnbase", "windef", "winnt"], &[]),
316+
("shobjidl_core", &["commctrl", "guiddef", "minwinbase", "minwindef", "objidl", "propkeydef", "propsys", "shtypes", "unknwnbase", "windef", "winnt"], &[]),
317317
("shtypes", &["guiddef", "minwindef", "winnt"], &[]),
318318
("softpub", &[], &[]),
319319
("spapidef", &["minwindef", "winnt"], &[]),

src/um/objidl.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use shared::minwindef::{BOOL, BYTE, DWORD, FILETIME, HGLOBAL, ULONG, WORD};
1111
use shared::ntdef::LONG;
1212
use shared::windef::{HBITMAP, HENHMETAFILE};
1313
use shared::wtypes::{CLIPFORMAT, HMETAFILEPICT};
14-
use shared::wtypesbase::{LPOLESTR, OLECHAR};
14+
use shared::wtypesbase::{LPCOLESTR, LPOLESTR, OLECHAR};
1515
use um::objidlbase::{IEnumString, IStream, STATSTG};
1616
use um::unknwnbase::{IUnknown, IUnknownVtbl};
1717
use um::winnt::{HRESULT, ULARGE_INTEGER};
@@ -316,6 +316,24 @@ interface IStorage(IStorageVtbl): IUnknown(IUnknownVtbl) {
316316
grfStatFlag: DWORD,
317317
) -> HRESULT,
318318
}}
319+
RIDL!{#[uuid(0x0000010b, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)]
320+
interface IPersistFile(IPersistFileVtbl): IPersist(IPersistVtbl) {
321+
fn IsDirty() -> HRESULT,
322+
fn Load(
323+
pszFileName: LPCOLESTR,
324+
dwMode: DWORD,
325+
) -> HRESULT,
326+
fn Save(
327+
pszFileName: LPCOLESTR,
328+
fRemember: BOOL,
329+
) -> HRESULT,
330+
fn SaveCompleted(
331+
pszFileName: LPCOLESTR,
332+
) -> HRESULT,
333+
fn GetCurFile(
334+
ppszFileName: *mut LPOLESTR,
335+
) -> HRESULT,
336+
}}
319337
STRUCT!{struct DVTARGETDEVICE {
320338
tdSize: DWORD,
321339
tdDriverNameOffset: WORD,

src/um/shobjidl_core.rs

Lines changed: 139 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ use shared::guiddef::{REFGUID, REFIID};
88
use shared::minwindef::{BOOL, DWORD, UINT, ULONG, WORD};
99
use shared::windef::{COLORREF, HICON, HWND, RECT};
1010
use um::commctrl::HIMAGELIST;
11+
use um::minwinbase::{WIN32_FIND_DATAA, WIN32_FIND_DATAW};
1112
use um::objidl::IBindCtx;
1213
use um::propkeydef::REFPROPERTYKEY;
1314
use um::propsys::GETPROPERTYSTOREFLAGS;
15+
use um::shtypes::{PCIDLIST_ABSOLUTE, PIDLIST_ABSOLUTE};
1416
use um::unknwnbase::{IUnknown, IUnknownVtbl};
15-
use um::winnt::{HRESULT, LPCWSTR, LPWSTR, ULONGLONG, WCHAR};
17+
use um::winnt::{HRESULT, LPCSTR, LPCWSTR, LPSTR, LPWSTR, ULONGLONG, WCHAR};
1618
DEFINE_GUID!{CLSID_DesktopWallpaper,
1719
0xc2cf3110, 0x460e, 0x4fc1, 0xb9, 0xd0, 0x8a, 0x1c, 0x0c, 0x9c, 0xc4, 0xbd}
1820
DEFINE_GUID!{CLSID_TaskbarList,
@@ -344,6 +346,142 @@ interface IDesktopWallpaper(IDesktopWallpaperVtbl): IUnknown(IUnknownVtbl) {
344346
enable: BOOL,
345347
) -> HRESULT,
346348
}}
349+
RIDL!{#[uuid(0x000214ee, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)]
350+
interface IShellLinkA(IShellLinkAVtbl): IUnknown(IUnknownVtbl) {
351+
fn GetPath(
352+
pszFile: LPSTR,
353+
cch: c_int,
354+
pfd: *mut WIN32_FIND_DATAA,
355+
fFlags: DWORD,
356+
) -> HRESULT,
357+
fn GetIDList(
358+
ppidl: *mut PIDLIST_ABSOLUTE,
359+
) -> HRESULT,
360+
fn SetIDList(
361+
pidl: PCIDLIST_ABSOLUTE,
362+
) -> HRESULT,
363+
fn GetDescription(
364+
pszName: LPSTR,
365+
cch: c_int,
366+
) -> HRESULT,
367+
fn SetDescription(
368+
pszName: LPCSTR,
369+
) -> HRESULT,
370+
fn GetWorkingDirectory(
371+
pszDir: LPSTR,
372+
cch: c_int,
373+
) -> HRESULT,
374+
fn SetWorkingDirectory(
375+
pszDir: LPCSTR,
376+
) -> HRESULT,
377+
fn GetArguments(
378+
pszArgs: LPSTR,
379+
cch: c_int,
380+
) -> HRESULT,
381+
fn SetArguments(
382+
pszArgs: LPCSTR,
383+
) -> HRESULT,
384+
fn GetHotkey(
385+
pwHotkey: *mut WORD,
386+
) -> HRESULT,
387+
fn SetHotkey(
388+
wHotkey: WORD,
389+
) -> HRESULT,
390+
fn GetShowCmd(
391+
piShowCmd: *mut c_int,
392+
) -> HRESULT,
393+
fn SetShowCmd(
394+
iShowCmd: c_int,
395+
) -> HRESULT,
396+
fn GetIconLocation(
397+
pszIconPath: LPSTR,
398+
cch: c_int,
399+
piIcon: *mut c_int,
400+
) -> HRESULT,
401+
fn SetIconLocation(
402+
pszIconPath: LPCSTR,
403+
iIcon: c_int,
404+
) -> HRESULT,
405+
fn SetRelativePath(
406+
pszPathRel: LPCSTR,
407+
dwReserved: DWORD,
408+
) -> HRESULT,
409+
fn Resolve(
410+
hwnd: HWND,
411+
fFlags: DWORD,
412+
) -> HRESULT,
413+
fn SetPath(
414+
pszFile: LPCSTR,
415+
) -> HRESULT,
416+
}}
417+
RIDL!{#[uuid(0x000214f9, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)]
418+
interface IShellLinkW(IShellLinkWVtbl): IUnknown(IUnknownVtbl) {
419+
fn GetPath(
420+
pszFile: LPWSTR,
421+
cch: c_int,
422+
pfd: *mut WIN32_FIND_DATAW,
423+
fFlags: DWORD,
424+
) -> HRESULT,
425+
fn GetIDList(
426+
ppidl: *mut PIDLIST_ABSOLUTE,
427+
) -> HRESULT,
428+
fn SetIDList(
429+
pidl: PCIDLIST_ABSOLUTE,
430+
) -> HRESULT,
431+
fn GetDescription(
432+
pszName: LPWSTR,
433+
cch: c_int,
434+
) -> HRESULT,
435+
fn SetDescription(
436+
pszName: LPCWSTR,
437+
) -> HRESULT,
438+
fn GetWorkingDirectory(
439+
pszDir: LPWSTR,
440+
cch: c_int,
441+
) -> HRESULT,
442+
fn SetWorkingDirectory(
443+
pszDir: LPCWSTR,
444+
) -> HRESULT,
445+
fn GetArguments(
446+
pszArgs: LPWSTR,
447+
cch: c_int,
448+
) -> HRESULT,
449+
fn SetArguments(
450+
pszArgs: LPCWSTR,
451+
) -> HRESULT,
452+
fn GetHotkey(
453+
pwHotkey: *mut WORD,
454+
) -> HRESULT,
455+
fn SetHotkey(
456+
wHotkey: WORD,
457+
) -> HRESULT,
458+
fn GetShowCmd(
459+
piShowCmd: *mut c_int,
460+
) -> HRESULT,
461+
fn SetShowCmd(
462+
iShowCmd: c_int,
463+
) -> HRESULT,
464+
fn GetIconLocation(
465+
pszIconPath: LPWSTR,
466+
cch: c_int,
467+
piIcon: *mut c_int,
468+
) -> HRESULT,
469+
fn SetIconLocation(
470+
pszIconPath: LPCWSTR,
471+
iIcon: c_int,
472+
) -> HRESULT,
473+
fn SetRelativePath(
474+
pszPathRel: LPCWSTR,
475+
dwReserved: DWORD,
476+
) -> HRESULT,
477+
fn Resolve(
478+
hwnd: HWND,
479+
fFlags: DWORD,
480+
) -> HRESULT,
481+
fn SetPath(
482+
pszFile: LPCWSTR,
483+
) -> HRESULT,
484+
}}
347485
RIDL!{#[uuid(0xc2cf3110, 0x460e, 0x4fc1, 0xb9, 0xd0, 0x8a, 0x1c, 0x0c, 0x9c, 0xc4, 0xbd)]
348486
class DesktopWallpaper;}
349487
RIDL!{#[uuid(0x00021400, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)]

0 commit comments

Comments
 (0)