I'm not quite sure I understand what you want to do. But I guess it would almost be the same as what you gave us there.
[php]
return *(ULONG_PTR*)((*(ULONG_PTR*)ulBase)+nOffset);
[/php]
I don't quite know how offsets work and such, but I understand what you did here. Dereference the base address, add the offset to that. Cast into a ULONG_PTR and dereference and return the contents.
If you want to write, I'm not 100% sure, but I think it may be similar to that.
[php]
*( ULONG_PTR* ) ( ( *(ULONG_PTR*)BaseAddress ) +offset ) = Somevalue;
[/php]
I've never tried anything like this, so if someone would please correct me if I've made some mistakes.