The defacto answer to that is "it depends".

When you say modify, are you speaking of a native service to the OS? If so, then clearly the answer is that you don't. If you are speaking of a third party service, then the answer is maybe. Look over the EULA and see what it says about mods. Typically you will find source code along with the service.

Also, when you say modify, you are using the biggest generalization on the planet. Something like, "How can I change the number of threads are spawned by a service or how can I change the default port a service runs on?" would be much better than the general nature of your question. A detailed description of what you are doing wouldn't hurt either.

--TH13