2025. 5. 23. 18:47

A lambda to a pointer to function

Recently, I changed the lambda code to capture a local variable, and then the code didn't compile.
What I found was that only a lambda without capture can be converted to a function pointer.

 

[expr.prim.lambda]

The closure type for a lambda-expression with no lambda-capture has a public non-virtual non-explicit const conversion function to pointer to function having the same parameter and return types as the closure type's function call operator. The value returned by this conversion function shall be the address of a function that, when invoked, has the same effect as invoking the closure type's function call operator.
2022. 9. 2. 18:45

NtCreateToken

NtCreateToken

Return Codes

  • STATUS_SUCCESS - Indicates the operation was successful.
  • STATUS_INVALID_OWNER - Indicates the ID provided to be assigned
            as the default owner of the token does not have an attribute
            indicating it may be assigned as an owner.
  • STATUS_INVALID_PRIMARY_GROUP - Indicates the group ID provided
            via the PrimaryGroup parameter was not among those assigned
            to the token in the Groups parameter.
  • STATUS_BAD_IMPERSONATION_LEVEL - Indicates no impersonation level
            was provided when attempting to create a token of type
            TokenImpersonation.

createprocess-windows

2022. 5. 30. 16:02

Getting a device ID

2021. 12. 31. 14:17

LLDB

2021. 11. 23. 14:34

How to change the foreground window

2021. 9. 15. 18:49

App Container

2021. 6. 1. 16:18

c++ User defined literals

2021. 5. 14. 13:11

Remote Debugging

Remote Debugging

  • Remote Side(e.g. 192.168.129.2)
    • Install Command Line Tools for Xcode
    • Run debugserver(/Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources ver 12.5)
    • Usage:
      debugserver host:port [program-name program-arg1 program-arg2 ...]
      debugserver /path/file [program-name program-arg1 program-arg2 ...]
      debugserver host:port --attach=<pid>
      debugserver /path/file --attach=<pid>
      debugserver host:port --attach=<process_name>
      debugserver /path/file --attach=<process_name>
      host: Local Side
      e.g.:
      debugserver 192.168.129.1:1600 --attach=1234

      Attaching to process 2051...
      Listening to port 1600 for a connection from 192.168.129.1...


  • Local Side(e.g. 192.168.129.1)
    • Run lldb
    • Then enter this command: process connect connect://192.168.129.2:1600
  • Set the entitlement
    • The debugee should have 'com.apple.security.get-task-allow' entitlement in order to be attached by debuggers.
    • In debug mode it is set, but in release mode it is stripped.
    • Build Settings > Signing > Code Signing inject Base Entitlements > 'Yes'

 

 

2021. 5. 13. 18:40

VMware Fusion

2021. 5. 12. 16:34

Sysmon