Skip to content

Commit 54a987d

Browse files
committed
fix #10612 x64 portable does not work with Pageant
1 parent 53175c0 commit 54a987d

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

pageant/src/wmmessage.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,26 +236,20 @@ pub fn query_pageant_direct(cookie: String, msg: &[u8]) -> Result<Vec<u8>, Error
236236
let user = get_current_process_user()?;
237237

238238
let mut sd = SECURITY_DESCRIPTOR::default();
239-
let sa = SECURITY_ATTRIBUTES {
240-
lpSecurityDescriptor: &mut sd as *mut _ as *mut _,
241-
bInheritHandle: true.into(),
242-
nLength: size_of::<SECURITY_ATTRIBUTES>() as u32,
243-
};
244-
245239
let psd = PSECURITY_DESCRIPTOR(&mut sd as *mut _ as *mut _);
246240

247241
unsafe {
248242
InitializeSecurityDescriptor(psd, 1)?;
249243
SetSecurityDescriptorOwner(psd, Some(user.User.Sid), false)?;
250244
}
251245

252-
let mut map: MemoryMap = MemoryMap::new(map_name.clone(), _AGENT_MAX_MSGLEN, Some(sa))?;
246+
let mut map: MemoryMap = MemoryMap::new(map_name.clone(), _AGENT_MAX_MSGLEN, None)?;
253247
map.write(msg)?;
254248

255249
let char_buffer = CString::new(map_name.as_bytes()).map_err(|_| Error::InvalidCookie)?;
256250
let cds = COPYDATASTRUCT {
257251
dwData: _AGENT_COPYDATA_ID as usize,
258-
cbData: char_buffer.as_bytes().len() as u32,
252+
cbData: char_buffer.as_bytes().len() as u32 + 1,
259253
lpData: char_buffer.as_bytes().as_ptr() as *mut _,
260254
};
261255

0 commit comments

Comments
 (0)