本文整理汇总了Golang中github.com/winlabs/gowin32/wrappers.FAILED函数的典型用法代码示例。如果您正苦于以下问题:Golang FAILED函数的具体用法?Golang FAILED怎么用?Golang FAILED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FAILED函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TranslateADName
func TranslateADName(name string, fromType ADNameType, toType ADNameType) (string, error) {
var object uintptr
hr := wrappers.CoCreateInstance(
&wrappers.CLSID_NameTranslate,
nil,
wrappers.CLSCTX_INPROC_SERVER,
&wrappers.IID_IADsNameTranslate,
&object)
if wrappers.FAILED(hr) {
return "", NewWindowsError("CoCreateInstance", COMError(hr))
}
trans := (*wrappers.IADsNameTranslate)(unsafe.Pointer(object))
defer trans.Release()
if hr := trans.Init(wrappers.ADS_NAME_INITTYPE_GC, nil); wrappers.FAILED(hr) {
return "", NewWindowsError("IADsNameTranslate::Init", COMError(hr))
}
nameRaw := wrappers.SysAllocString(syscall.StringToUTF16Ptr(name))
defer wrappers.SysFreeString(nameRaw)
if hr := trans.Set(int32(fromType), nameRaw); wrappers.FAILED(hr) {
return "", NewWindowsError("IADsNameTranslate::Set", COMError(hr))
}
var outRaw *uint16
if hr := trans.Get(int32(toType), &outRaw); wrappers.FAILED(hr) {
return "", NewWindowsError("IADsNameTranslate::Get", COMError(hr))
}
return BstrToString(outRaw), nil
}
示例2: NewEnumerator
func (self *FirewallRuleCollection) NewEnumerator() (*FirewallRuleEnumerator, error) {
if self.object == nil {
return nil, NewWindowsError("INetFwRules::get__NewEnum", COMErrorPointer)
}
var punkEnumerator *wrappers.IUnknown
if hr := self.object.Get__NewEnum(&punkEnumerator); wrappers.FAILED(hr) {
return nil, NewWindowsError("INetFwRules::get__NewEnum", COMError(hr))
}
defer punkEnumerator.Release()
var enumerator uintptr
if hr := punkEnumerator.QueryInterface(&wrappers.IID_IEnumVARIANT, &enumerator); wrappers.FAILED(hr) {
return nil, NewWindowsError("IUnknown::QueryInterface", COMError(hr))
}
return &FirewallRuleEnumerator{object: (*wrappers.IEnumVARIANT)(unsafe.Pointer(enumerator))}, nil
}
示例3: GetSpecialFolderPath
func GetSpecialFolderPath(folder SpecialFolder) (string, error) {
buf := [wrappers.MAX_PATH]uint16{}
if hr := wrappers.SHGetFolderPath(0, uint32(folder), 0, 0, &buf[0]); wrappers.FAILED(hr) {
return "", NewWindowsError("SHGetFolderPath", COMError(hr))
}
return syscall.UTF16ToString((&buf)[:]), nil
}
示例4: GetKnownFolderPath
func GetKnownFolderPath(folder KnownFolder) (string, error) {
var path *uint16
if hr := wrappers.SHGetKnownFolderPath((*wrappers.GUID)(&folder), 0, 0, &path); wrappers.FAILED(hr) {
return "", NewWindowsError("SHGetKnownFolderPath", COMError(hr))
}
defer wrappers.CoTaskMemFree((*byte)(unsafe.Pointer(path)))
return LpstrToString(path), nil
}
示例5: SetProtocol
func (self *FirewallRule) SetProtocol(protocol FirewallProtocol) error {
if self.object == nil {
return NewWindowsError("INetFwRule::put_Protocol", COMErrorPointer)
}
if hr := self.object.Put_Protocol(int32(protocol)); wrappers.FAILED(hr) {
return NewWindowsError("INetFwRule::put_Protocol", COMError(hr))
}
return nil
}
示例6: Skip
func (self *FirewallRuleEnumerator) Skip(count uint) error {
if self.object == nil {
return NewWindowsError("IEnumVARIANT::Skip", COMErrorPointer)
}
if hr := self.object.Skip(uint32(count)); wrappers.FAILED(hr) {
return NewWindowsError("IEnumVARIANT::Skip", COMError(hr))
}
return nil
}
示例7: SetAction
func (self *FirewallRule) SetAction(action FirewallAction) error {
if self.object == nil {
return NewWindowsError("INetFwRule::put_Action", COMErrorPointer)
}
if hr := self.object.Put_Action(int32(action)); wrappers.FAILED(hr) {
return NewWindowsError("INetFwRule::put_Action", COMError(hr))
}
return nil
}
示例8: SetEdgeTraversal
func (self *FirewallRule) SetEdgeTraversal(enabled bool) error {
if self.object == nil {
return NewWindowsError("INetFwRule::put_EdgeTraversal", COMErrorPointer)
}
if hr := self.object.Put_EdgeTraversal(enabled); wrappers.FAILED(hr) {
return NewWindowsError("INetFwRule::put_EdgeTraversal", COMError(hr))
}
return nil
}
示例9: Reset
func (self *FirewallRuleEnumerator) Reset() error {
if self.object == nil {
return NewWindowsError("IEnumVARIANT::Reset", COMErrorPointer)
}
if hr := self.object.Reset(); wrappers.FAILED(hr) {
return NewWindowsError("IEnumVARIANT::Reset", COMError(hr))
}
return nil
}
示例10: Add
func (self *FirewallRuleCollection) Add(rule *FirewallRule) error {
if self.object == nil {
return NewWindowsError("INetFwRules::Add", COMErrorPointer)
}
if hr := self.object.Add(rule.object); wrappers.FAILED(hr) {
return NewWindowsError("INetFwRules::Add", COMError(hr))
}
return nil
}
示例11: GetEdgeTraversal
func (self *FirewallRule) GetEdgeTraversal() (bool, error) {
if self.object == nil {
return false, NewWindowsError("INetFwRule::get_EdgeTraversal", COMErrorPointer)
}
var enabled bool
if hr := self.object.Get_EdgeTraversal(&enabled); wrappers.FAILED(hr) {
return false, NewWindowsError("INetFwRule::put_EdgeTraversal", COMError(hr))
}
return enabled, nil
}
示例12: GetGrouping
func (self *FirewallRule) GetGrouping() (string, error) {
if self.object == nil {
return "", NewWindowsError("INetFwRule::get_Grouping", COMErrorPointer)
}
var contextRaw *uint16
if hr := self.object.Get_Grouping(&contextRaw); wrappers.FAILED(hr) {
return "", NewWindowsError("INetFwRule::get_Grouping", COMError(hr))
}
return BstrToString(contextRaw), nil
}
示例13: GetAction
func (self *FirewallRule) GetAction() (FirewallAction, error) {
if self.object == nil {
return 0, NewWindowsError("INetFwRule::get_Action", COMErrorPointer)
}
var actionRaw int32
if hr := self.object.Get_Action(&actionRaw); wrappers.FAILED(hr) {
return 0, NewWindowsError("INetFwRule::get_Action", COMError(hr))
}
return FirewallAction(actionRaw), nil
}
示例14: GetDescription
func (self *FirewallRule) GetDescription() (string, error) {
if self.object == nil {
return "", NewWindowsError("INetFwRule::get_Description", COMErrorPointer)
}
var descRaw *uint16
if hr := self.object.Get_Description(&descRaw); wrappers.FAILED(hr) {
return "", NewWindowsError("INetFwRule::get_Description", COMError(hr))
}
return BstrToString(descRaw), nil
}
示例15: GetRemoteAddresses
func (self *FirewallRule) GetRemoteAddresses() (string, error) {
if self.object == nil {
return "", NewWindowsError("INetFwRule::get_RemoteAddresses", COMErrorPointer)
}
var remoteAddrsRaw *uint16
if hr := self.object.Get_RemoteAddresses(&remoteAddrsRaw); wrappers.FAILED(hr) {
return "", NewWindowsError("INetFwRule::get_RemoteAddresses", COMError(hr))
}
return BstrToString(remoteAddrsRaw), nil
}