lpBytes here is binary data. It is actually the resource content we are passing to the function UpdateResource.
Unfortunately, UpdateResource takes the resource data as parameter, not the attributes like "FileVersion". So we need to send "Version" data content.
There are two ways you can achieve this.
1) Get the fileversion using GetFileVersionInfo from the .exe, update it, make a resource of that content and then update the same to .exe using UpdateResource. This is could be errorneous as we are trying to modify the memory.
2) Second way is, you can get the "Version" resource data from another .exe file and use the same to pass it to the .exe you want to update. By this, you will have the "Version" details of an exe say app1.exe copied to another exe, say app2.exe. This can be done as in the code below,