You must lock execute buffers before you can modify them. This action prevents the driver from modifying the buffer while you are working with it.
To lock a buffer, call the IDirect3DExecuteBuffer::Lock method. This method takes a single parameter; a pointer to a D3DEXECUTEBUFFERDESC structure which, on return, specifies the actual location of the execute buffer's memory.
When working with execute buffers you need to manage three pointers: the execute buffer's start address (retrieved by IDirect3DExecuteBuffer::Lock), the instruction start address, and your current position in the buffer. You use these three pointers to compute vertex offsets, instruction offsets, and the overall size of the execute buffer. After you have finished filling the execute buffer, you use these pointers to describe the buffer to the driver; for more information, see Unlocking the Execute Buffer.