Skip to content

Commit

Permalink
Merge pull request #88 from enthought/handle-resource-name-null
Browse files Browse the repository at this point in the history
Stop enumeration when name is null
  • Loading branch information
itziakos authored Sep 23, 2020
2 parents b112ca8 + 392782c commit 28364ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions win32ctypes/core/cffi/_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def wrapped(hModule, lpszType, lParam):

def ENUMRESNAMEPROC(callback):
def wrapped(hModule, lpszType, lpszName, lParam):
if lpszName == ffi.NULL:
return False
return callback(
hModule, resource(lpszType), resource(lpszName), lParam)
return wrapped
Expand Down
4 changes: 3 additions & 1 deletion win32ctypes/core/ctypes/_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def wrapped(handle, type_, name, param):
type_ = int(type_)
else:
type_ = ctypes.cast(type_, LPCWSTR).value
if IS_INTRESOURCE(name):
if name is None:
return False
elif IS_INTRESOURCE(name):
name = int(name)
else:
name = ctypes.cast(name, LPCWSTR).value
Expand Down

0 comments on commit 28364ce

Please sign in to comment.