mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 14:23:40 +01:00
Add GetImageFilePath
This commit is contained in:
parent
6f6792f27e
commit
2e4796f8bf
6 changed files with 39 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ using Microsoft.Win32.SafeHandles;
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Dalamud.Bootstrap
|
||||
{
|
||||
|
|
@ -210,5 +211,22 @@ namespace Dalamud.Bootstrap
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetImageFilePath()
|
||||
{
|
||||
var buffer = new StringBuilder(300);
|
||||
|
||||
// From docs:
|
||||
// On input, specifies the size of the lpExeName buffer, in characters.
|
||||
// On success, receives the number of characters written to the buffer, not including the null-terminating character.
|
||||
var size = buffer.Capacity;
|
||||
|
||||
if (!Win32.QueryFullProcessImageNameW(m_handle, 0, buffer, ref size))
|
||||
{
|
||||
ProcessException.ThrowLastOsError(GetPid());
|
||||
}
|
||||
|
||||
return buffer.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue