@@ -120,110 +120,112 @@ type _IFileDialogEventsVt struct {
120120var _iFileDialogEventsVtPtrs _IFileDialogEventsVt // Global to keep the syscall callback pointers.
121121
122122func (me * _IFileDialogEventsVt ) init () {
123- if me .QueryInterface == 0 { // initialize only once
124- * me = _IFileDialogEventsVt {
125- _IUnknownVt : _IUnknownVt {
126- QueryInterface : syscall .NewCallback (
127- func (_p uintptr , _riid uintptr , ppv * * * _IUnknownVt ) uintptr {
128- * ppv = nil
129- return uintptr (co .HRESULT_E_NOTIMPL )
130- },
131- ),
132- AddRef : syscall .NewCallback (
133- func (p uintptr ) uintptr {
134- ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
135- newCount := atomic .AddUint32 (& (* * ppImpl ).counter , 1 )
136- return uintptr (newCount )
137- },
138- ),
139- Release : syscall .NewCallback (
140- func (p uintptr ) uintptr {
141- ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
142- newCount := atomic .AddUint32 (& (* ppImpl ).counter , ^ uint32 (0 )) // decrement 1
143- if newCount == 0 {
144- utl .PtrCache .Delete (unsafe .Pointer (* ppImpl )) // now GC can collect them
145- utl .PtrCache .Delete (unsafe .Pointer (ppImpl ))
146- }
147- return uintptr (newCount )
148- },
149- ),
150- },
151- OnFileOk : syscall .NewCallback (
152- func (p uintptr , _ * * _IUnknownVt ) uintptr {
153- ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
154- if fun := (* ppImpl ).onFileOk ; fun == nil { // user didn't define a callback
155- return uintptr (co .HRESULT_S_OK )
156- } else {
157- return uintptr (fun ())
158- }
159- },
160- ),
161- OnFolderChanging : syscall .NewCallback (
162- func (p uintptr , _ * * _IUnknownVt , vtSi * * _IUnknownVt ) uintptr {
163- ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
164- if fun := (* ppImpl ).onFolderChanging ; fun == nil { // user didn't define a callback
165- return uintptr (co .HRESULT_S_OK )
166- } else {
167- return uintptr (fun (& IShellItem {IUnknown {vtSi }}))
168- }
169- },
170- ),
171- OnFolderChange : syscall .NewCallback (
172- func (p uintptr , _ * * _IUnknownVt ) uintptr {
173- ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
174- if fun := (* ppImpl ).onFolderChange ; fun == nil { // user didn't define a callback
175- return uintptr (co .HRESULT_S_OK )
176- } else {
177- return uintptr (fun ())
178- }
179- },
180- ),
181- OnSelectionChange : syscall .NewCallback (
182- func (p uintptr , _ * * _IUnknownVt ) uintptr {
183- ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
184- if fun := (* ppImpl ).onSelectionChange ; fun == nil { // user didn't define a callback
185- return uintptr (co .HRESULT_S_OK )
186- } else {
187- return uintptr (fun ())
188- }
189- },
190- ),
191- OnShareViolation : syscall .NewCallback (
192- func (p uintptr , _ * * _IUnknownVt , vtSi * * _IUnknownVt , pResponse * uint32 ) uintptr {
193- ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
194- if fun := (* ppImpl ).onShareViolation ; fun == nil { // user didn't define a callback
195- return uintptr (co .HRESULT_S_OK )
196- } else {
197- return uintptr (fun (
198- & IShellItem {IUnknown {vtSi }},
199- (* co .FDESVR )(pResponse ),
200- ))
201- }
123+ if me .QueryInterface != 0 {
124+ return
125+ }
126+
127+ * me = _IFileDialogEventsVt {
128+ _IUnknownVt : _IUnknownVt {
129+ QueryInterface : syscall .NewCallback (
130+ func (_p uintptr , _riid uintptr , ppv * * * _IUnknownVt ) uintptr {
131+ * ppv = nil
132+ return uintptr (co .HRESULT_E_NOTIMPL )
202133 },
203134 ),
204- OnTypeChange : syscall .NewCallback (
205- func (p uintptr , _ * * _IUnknownVt ) uintptr {
135+ AddRef : syscall .NewCallback (
136+ func (p uintptr ) uintptr {
206137 ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
207- if fun := (* ppImpl ).onTypeChange ; fun == nil { // user didn't define a callback
208- return uintptr (co .HRESULT_S_OK )
209- } else {
210- return uintptr (fun ())
211- }
138+ newCount := atomic .AddUint32 (& (* * ppImpl ).counter , 1 )
139+ return uintptr (newCount )
212140 },
213141 ),
214- OnOverwrite : syscall .NewCallback (
215- func (p uintptr , _ * * _IUnknownVt , vtSi * * _IUnknownVt , pResponse * uint32 ) uintptr {
142+ Release : syscall .NewCallback (
143+ func (p uintptr ) uintptr {
216144 ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
217- if fun := (* ppImpl ).onOverwrite ; fun == nil { // user didn't define a callback
218- return uintptr (co .HRESULT_S_OK )
219- } else {
220- return uintptr (fun (
221- & IShellItem {IUnknown {vtSi }},
222- (* co .FDEOR )(pResponse ),
223- ))
145+ newCount := atomic .AddUint32 (& (* ppImpl ).counter , ^ uint32 (0 )) // decrement 1
146+ if newCount == 0 {
147+ utl .PtrCache .Delete (unsafe .Pointer (* ppImpl )) // now GC can collect them
148+ utl .PtrCache .Delete (unsafe .Pointer (ppImpl ))
224149 }
150+ return uintptr (newCount )
225151 },
226152 ),
227- }
153+ },
154+ OnFileOk : syscall .NewCallback (
155+ func (p uintptr , _ * * _IUnknownVt ) uintptr {
156+ ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
157+ if fun := (* ppImpl ).onFileOk ; fun == nil { // user didn't define a callback
158+ return uintptr (co .HRESULT_S_OK )
159+ } else {
160+ return uintptr (fun ())
161+ }
162+ },
163+ ),
164+ OnFolderChanging : syscall .NewCallback (
165+ func (p uintptr , _ * * _IUnknownVt , vtSi * * _IUnknownVt ) uintptr {
166+ ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
167+ if fun := (* ppImpl ).onFolderChanging ; fun == nil { // user didn't define a callback
168+ return uintptr (co .HRESULT_S_OK )
169+ } else {
170+ return uintptr (fun (& IShellItem {IUnknown {vtSi }}))
171+ }
172+ },
173+ ),
174+ OnFolderChange : syscall .NewCallback (
175+ func (p uintptr , _ * * _IUnknownVt ) uintptr {
176+ ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
177+ if fun := (* ppImpl ).onFolderChange ; fun == nil { // user didn't define a callback
178+ return uintptr (co .HRESULT_S_OK )
179+ } else {
180+ return uintptr (fun ())
181+ }
182+ },
183+ ),
184+ OnSelectionChange : syscall .NewCallback (
185+ func (p uintptr , _ * * _IUnknownVt ) uintptr {
186+ ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
187+ if fun := (* ppImpl ).onSelectionChange ; fun == nil { // user didn't define a callback
188+ return uintptr (co .HRESULT_S_OK )
189+ } else {
190+ return uintptr (fun ())
191+ }
192+ },
193+ ),
194+ OnShareViolation : syscall .NewCallback (
195+ func (p uintptr , _ * * _IUnknownVt , vtSi * * _IUnknownVt , pResponse * uint32 ) uintptr {
196+ ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
197+ if fun := (* ppImpl ).onShareViolation ; fun == nil { // user didn't define a callback
198+ return uintptr (co .HRESULT_S_OK )
199+ } else {
200+ return uintptr (fun (
201+ & IShellItem {IUnknown {vtSi }},
202+ (* co .FDESVR )(pResponse ),
203+ ))
204+ }
205+ },
206+ ),
207+ OnTypeChange : syscall .NewCallback (
208+ func (p uintptr , _ * * _IUnknownVt ) uintptr {
209+ ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
210+ if fun := (* ppImpl ).onTypeChange ; fun == nil { // user didn't define a callback
211+ return uintptr (co .HRESULT_S_OK )
212+ } else {
213+ return uintptr (fun ())
214+ }
215+ },
216+ ),
217+ OnOverwrite : syscall .NewCallback (
218+ func (p uintptr , _ * * _IUnknownVt , vtSi * * _IUnknownVt , pResponse * uint32 ) uintptr {
219+ ppImpl := (* * _IFileDialogEventsImpl )(unsafe .Pointer (p ))
220+ if fun := (* ppImpl ).onOverwrite ; fun == nil { // user didn't define a callback
221+ return uintptr (co .HRESULT_S_OK )
222+ } else {
223+ return uintptr (fun (
224+ & IShellItem {IUnknown {vtSi }},
225+ (* co .FDEOR )(pResponse ),
226+ ))
227+ }
228+ },
229+ ),
228230 }
229231}
0 commit comments