Skip to content

Commit 613a278

Browse files
authored
Merge pull request #1488 from SteveL-MSFT/backport-psadapter
Backport: Add newer PS Adapters to pkg and Firewall enhancement
2 parents 62ba247 + 90a22c5 commit 613a278

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

data.build.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"powershell.dsc.extension.json",
2323
"powershell.discover.ps1",
2424
"powershell.dsc.resource.json",
25+
"PowerShell_adapter.dsc.resource.json",
2526
"psDscAdapter/",
2627
"psscript.ps1",
2728
"psscript.dsc.resource.json",
@@ -51,6 +52,7 @@
5152
"powershell.dsc.extension.json",
5253
"powershell.discover.ps1",
5354
"powershell.dsc.resource.json",
55+
"PowerShell_adapter.dsc.resource.json",
5456
"psDscAdapter/",
5557
"psscript.ps1",
5658
"psscript.dsc.resource.json",
@@ -83,6 +85,7 @@
8385
"powershell.dsc.extension.json",
8486
"powershell.discover.ps1",
8587
"powershell.dsc.resource.json",
88+
"PowerShell_adapter.dsc.resource.json",
8689
"psDscAdapter/",
8790
"psscript.ps1",
8891
"psscript.dsc.resource.json",
@@ -99,6 +102,7 @@
99102
"sshd-subsystem.dsc.resource.json",
100103
"sshd-subsystemList.dsc.resource.json",
101104
"windowspowershell.dsc.resource.json",
105+
"WindowsPowerShell_adapter.dsc.resource.json",
102106
"windowsupdate.dsc.resource.json",
103107
"wu_dsc.exe",
104108
"windows_firewall.dsc.resource.json",

resources/windows_firewall/src/firewall.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl SafeVariant {
2121
Self(VARIANT::default())
2222
}
2323

24-
fn as_mut_ptr(&mut self) -> *mut VARIANT {
24+
fn as_mut(&mut self) -> &mut VARIANT {
2525
&mut self.0
2626
}
2727

@@ -33,7 +33,7 @@ impl SafeVariant {
3333
impl Drop for SafeVariant {
3434
fn drop(&mut self) {
3535
if let Err(e) = unsafe { VariantClear(&mut self.0) } {
36-
crate::write_error(&format!("Warning: VariantClear failed with HRESULT: {:#010x}", e.code().0));
36+
crate::write_error(&format!("Warning: VariantClear failed with HRESULT: {:#010x}", e.code().0 as u32));
3737
}
3838
}
3939
}
@@ -81,8 +81,7 @@ impl FirewallStore {
8181
loop {
8282
let mut fetched = 0u32;
8383
let mut safe_variant = SafeVariant::new();
84-
let variant_slice = unsafe { std::slice::from_raw_parts_mut(safe_variant.as_mut_ptr(), 1) };
85-
let hr = unsafe { enum_variant.Next(variant_slice, &mut fetched) };
84+
let hr = unsafe { enum_variant.Next(std::slice::from_mut(safe_variant.as_mut()), &mut fetched) };
8685
if hr == S_FALSE || fetched == 0 {
8786
break;
8887
}

0 commit comments

Comments
 (0)