neorou, I might not understand your question clearly but here's my attempt at an answer:
1. If you wrote some code, before you joined the company, and later the code is use in the company to create some software, there are two issues at play:
1.a. Any code you write for the company belongs to the company. That's pretty much part of the contract. So, the company owns whatever code you write from scratch being a programmer at said company.
1.b. If you had sufficient copyright notice on your code, before you joined the company, they can't just eat it up, without your permission. Your ownership of whatever you wrote is protected by copyright law. Unless of course, you carelessly forgot to put up a copyright notice. In which case, it could be argued that the code was in public domain and you can't stop the company from using the code how they please.
2. If the code is under the GPL license or any other copyleft license, it can never be part of a closed source program.
3. If you wrote some code before joining the company, but didn't mention it to anyone, and later decided to incorporate this code, into some program you were writing for the company, the company can close source it but you can challenge this.
3.1. Ofcourse, you'd then have to prove the timeline of the original code and the new program and when the original code got incorporated into the company program.
Best to document things clearly and to discuss things with your superiors before you integrate your previously written code into the company program. Never do anything without proper approval from the company or their knowledge.
http://www.oss-watch.ac.uk/
http://www.oss-watch.ac.uk/resources/fossandpatents.xml
http://www.softwarefreedom.org/resources/2008/foss-primer.html
http://en.wikipedia.org/wiki/Software_license
http://en.wikipedia.org/wiki/Free_software_licence
[Modified by: Shashank Sharma on June 09, 2008 09:32 PM]
Coauthor of Beginning Fedora: From Novice to Professional published by Apress.
Please follow the Forum Guidelines