use super::{arg_dword, HostState, Registry, StubFn, Win32Error};
use crate::emulator::{Cpu, Mmu};
const SE_OK: u32 = 33;
pub fn register(registry: &mut Registry) {
registry.register(
"shell32.dll",
"ShellExecuteA",
stub_shell_execute as StubFn,
6,
);
registry.register(
"shell32.dll",
"ShellExecuteW",
stub_shell_execute as StubFn,
6,
);
registry.register(
"shell32.dll",
"SHGetFolderPathW",
stub_sh_get_folder_path_w as StubFn,
5,
);
registry.register(
"shell32.dll",
"Shell_NotifyIconA",
stub_shell_notify_icon as StubFn,
2,
);
}
fn stub_shell_execute(
_cpu: &mut Cpu,
_mmu: &mut Mmu,
_state: &mut HostState,
_registry: &Registry,
) -> Result<u32, Win32Error> {
Ok(SE_OK)
}
fn stub_sh_get_folder_path_w(
cpu: &mut Cpu,
mmu: &mut Mmu,
_state: &mut HostState,
_registry: &Registry,
) -> Result<u32, Win32Error> {
let path = arg_dword(cpu, mmu, 4)
.map_err(|t| crate::win32::trap_to_win32_local("SHGetFolderPathW", t))?;
if path != 0 {
mmu.store16(path, 0)
.map_err(|t| crate::win32::trap_to_win32_local("SHGetFolderPathW", t))?;
}
Ok(0)
}
fn stub_shell_notify_icon(
_cpu: &mut Cpu,
_mmu: &mut Mmu,
_state: &mut HostState,
_registry: &Registry,
) -> Result<u32, Win32Error> {
Ok(1)
}