Well the problem is that target process needs to have SeImpersonateUser
privilege, available only in SYSTEM
processes by default.
When the thread is impersonated, because the process hasn't the required privilege, the api will succeed but actual level will be Delegate instead of Impersonate and CreateFile
fails because of this.