Skip to content

Commit db0db8f

Browse files
committed
Cross-port review comment for library-development branch
1 parent dfdea98 commit db0db8f

File tree

6 files changed

+550
-40
lines changed

6 files changed

+550
-40
lines changed

docs/IMPLEMENTATION.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ can be used to retrieve a volume (`MSFT_Volume`) from a partition (`MSFT_Partiti
135135
collection, err := part.GetAssociated("MSFT_PartitionToVolume", "MSFT_Volume", "Volume", "Partition")
136136
```
137137

138+
### Disable checkptr
139+
140+
COM APIs (like IDispatch.Invoke, Variant, BSTR, IUnknown**, etc.) frequently use:
141+
* Double pointers (e.g., BSTR*, IUnknown**)
142+
* Pointers passed as int64 or uintptr
143+
* In-place modification via reference
144+
145+
These patterns are common and valid in C/C++, but violate Go’s unsafe.Pointer rules when interpreted literally - even if they are functionally correct.
146+
147+
Therefore, you should make sure `-gcflags=all=-d=checkptr=0` when calling `microsoft/wmi`.
148+
138149
<a name="debug-powershell"></a>
139150
## Debug with PowerShell
140151

pkg/os/disk/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ func (imp DiskAPI) SetDiskState(diskNumber uint32, isOnline bool) error {
397397
}
398398

399399
if isOnline == !isOffline {
400+
klog.V(2).Infof("Disk %d is already in the desired state", diskNumber)
400401
return nil
401402
}
402403

pkg/os/filesystem/api_test.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

pkg/os/system/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var (
7171

7272
serviceStateCheckInternal = 200 * time.Millisecond
7373
serviceStateCheckTimeout = 30 * time.Second
74-
errTimedOut = errors.New("Timed out")
74+
errTimedOut = errors.New("timed out")
7575
)
7676

7777
func serviceStartModeToStartType(startMode string) uint32 {

pkg/utils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func IsPathValid(path string) (bool, error) {
4040
return false, fmt.Errorf("failed to get path %s attribute: %w", path, err)
4141
}
4242

43-
klog.V(6).Infof("Path %s attribute: %d", path, attrs)
43+
klog.V(6).Infof("Path %s attribute: %O", path, attrs)
4444
return attrs != windows.INVALID_FILE_ATTRIBUTES, nil
4545
}
4646

0 commit comments

Comments
 (0)