Skip to content

Commit 57703ba

Browse files
committed
dispatch.go errors w/ more call context
1 parent e0a9aa8 commit 57703ba

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

pkg/goexec/dcom/dispatch.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/oiweiwei/go-msrpc/msrpc/dcom"
1111
"github.com/oiweiwei/go-msrpc/msrpc/dcom/oaut"
1212
"github.com/oiweiwei/go-msrpc/msrpc/dcom/oaut/idispatch/v0"
13+
1314
_ "github.com/oiweiwei/go-msrpc/msrpc/erref/hresult"
1415
_ "github.com/oiweiwei/go-msrpc/msrpc/erref/ntstatus"
1516
_ "github.com/oiweiwei/go-msrpc/msrpc/erref/win32"
@@ -63,10 +64,10 @@ func (m *Dispatch) callComMethod(ctx context.Context, id *dcom.IPID, method stri
6364
Names: []string{obj},
6465
}, opts...)
6566
if err != nil {
66-
return nil, fmt.Errorf("get dispatch ID of name %q: %w", obj, err)
67+
return nil, fmt.Errorf("call %q: get dispatch ID of name %q: %w", method, obj, err)
6768
}
6869
if len(gr.DispatchID) < 1 {
69-
return nil, fmt.Errorf("dispatch ID of name %q not found", obj)
70+
return nil, fmt.Errorf("call %q: dispatch ID of name %q not found", method, obj)
7071
}
7172
irq := &idispatch.InvokeRequest{
7273
This: &dcom.ORPCThis{Version: m.comVersion},
@@ -82,11 +83,11 @@ func (m *Dispatch) callComMethod(ctx context.Context, id *dcom.IPID, method stri
8283
irq.Flags = 2
8384
ir, err = m.dispatch.Invoke(ctx, irq, opts...)
8485
if err != nil {
85-
return nil, fmt.Errorf("get properties of object %q: %w", obj, err)
86+
return nil, fmt.Errorf("call %q: get properties of object %q: %w", method, obj, err)
8687
}
8788
di, ok := ir.VarResult.VarUnion.GetValue().(*oaut.Dispatch)
8889
if !ok {
89-
return nil, fmt.Errorf("invalid dispatch object for %q", obj)
90+
return nil, fmt.Errorf("call %q: invalid dispatch object for %q", method, obj)
9091
}
9192
id = di.InterfacePointer().GetStandardObjectReference().Std.IPID
9293
}

0 commit comments

Comments
 (0)